home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
D!Zone (Collector's Edition)
/
D_ZONE_CD.ISO
/
programs
/
editors
/
bsp11x
/
funcs.c
< prev
next >
Wrap
Text File
|
1994-12-06
|
985b
|
39 lines
/*- FUNCS.C ----------------------------------------------------------------*/
/*- terminate the program reporting an error -------------------------------*/
void ProgError( char *errstr, ...)
{
va_list args;
va_start( args, errstr);
printf( "\nProgram Error: *** ");
vprintf( errstr, args);
printf( " ***\n");
va_end( args);
exit( 5);
}
/*- allocate memory with error checking ------------------------------------*/
void *GetMemory( size_t size)
{
void *ret = malloc( size);
if (!ret)
ProgError( "out of memory (cannot allocate %u bytes)", size);
return ret;
}
/*- reallocate memory with error checking ----------------------------------*/
void *ResizeMemory( void *old, size_t size)
{
void *ret = realloc( old, size);
if (!ret)
ProgError( "out of memory (cannot reallocate %u bytes)", size);
return ret;
}
/*--------------------------------------------------------------------------*/