#include #include #include #include #include #include void no_space( void ) { char buf[MAX_ERROR_MSG_SIZE]; char *format = "%s: Cannot allocate memory"; snprintf( buf, MAX_ERROR_MSG_SIZE, format, "sila" ); fprintf( stderr, "%s", buf ); // FATAL_ERROR( "%s", buf ); // ++errors; // exit( 1 ); } void *xmalloc( size_t n ) { void *p = NULL; p = malloc( n ); if( !p ) no_space(); bzero( p, n ); return( p ); } void *xrealloc( void *b, size_t n ) { void *p = NULL; p = realloc( b , n ); if( !p ) no_space(); return( p ); } char *dupstr( char *s ) { char *r; r = xmalloc (strlen (s) + 1); strcpy (r, s); return (r); }