home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d473
/
cnewssrc
/
cnews_src.lzh
/
libc
/
emalloc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-30
|
442b
|
28 lines
/*
* emalloc - malloc with error() called when out of space
*/
#include <stdio.h>
#ifdef unix
# include <sys/types.h>
#endif /* unix */
#include "libc.h"
extern void error();
char *
emalloc(amount)
unsigned amount;
{
register char *it;
it = malloc(amount);
if (it == NULL) {
static char camount[25]; /* Enough to sprintf an unsigned. */
sprintf(camount, "%u", amount);
error("malloc(%s) failed", camount);
}
return(it);
}