home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Unix System Administration Handbook 1997 October
/
usah_oct97.iso
/
news
/
cnews.tar
/
libc
/
emalloc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-11-06
|
423b
|
27 lines
/*
* emalloc - malloc with error() called when out of space
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include "libc.h"
extern void error();
char *
emalloc(amount)
unsigned amount;
{
register char *it;
char camount[25]; /* Enough to sprintf an unsigned. */
it = malloc(amount);
if (it == NULL) {
sprintf(camount, "%u", amount);
error("malloc(%s) failed", camount);
}
return(it);
}