home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_09_08
/
9n08078b
< prev
next >
Wrap
Text File
|
1991-01-15
|
573b
|
20 lines
void *xalloc(size_t size)
{ void *p;
assert(size);
BEGIN_TRY { /* get some RAM */
if (!(p = malloc(size))) {
assert(errno == ENOMEM);
FAIL(X_ERRNO);
}
} FAIL_TRY { /* no RAM, so cram */
if (X_Error == X_ERRNO)
if (errno == ENOMEM)
if (CompactMem(size))
RETRY;
} END_TRY;
assert(p);
return p;
}