home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
unix
/
volume14
/
bsd-dyna-link
/
smalloc.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1988-05-08
|
261 b
|
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);
}