home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume14
/
bsd-dyna-link
/
smalloc.c
< prev
next >
Wrap
Text File
|
1988-05-08
|
261b
|
20 lines
static char error[] = "Out of memory\n";
int*
smalloc(size) /* "Safe" alloc */
{ int* retval = (int*)calloc(1,size);
if (retval == 0)
{ write(2, error, sizeof(error));
exit(-1);
}
else return retval;
}
sfree(ptr)
{
if (ptr != 0) free(ptr);
}