void *nmalloc(size_t nbytes) { void *ptr = ( nbytes == 0 ) ? NULL : calloc( nbytes, sizeof( void * ) ) ; if(!ptr) fatal("out of memory"); return ptr; } void *nrealloc(void *p, size_t nb) { void *newp = ( nb == 0 ) ? NULL : realloc(p, nb); if(!newp) fatal("out of memory"); return newp; } void nfree(void *ptr) { #ifdef DEBUG static void *last_ptr = NULL; #endif if(ptr == NULL) return; #ifdef DEBUG if(last_ptr == ptr) fatal("internal error: attempting to free same pointer twice"); else #endif if(ptr) free(ptr); }