Add replacement library files

This commit is contained in:
hpa 2001-03-30 01:02:55 +00:00
parent e6593dd693
commit d0fec7a322
4 changed files with 87 additions and 0 deletions

21
lib/xmalloc.c Normal file
View file

@ -0,0 +1,21 @@
/*
* xmalloc.c
*
* Simple error-checking version of malloc()
*
*/
#include <stdlib.h>
#include <stdio.h>
void *xmalloc(size_t size)
{
void *p = malloc(size);
if ( !p ) {
fprintf(stderr, "Out of memory!\n");
exit(128);
}
return p;
}