/* Like realloc, but abort if not enough memory is available. */ void *lib_realloc(void *ptr, size_t size) { #ifdef LIB_DEBUG void *new_ptr = lib_debug_libc_realloc(ptr, size); #else void *new_ptr = realloc(ptr, size); #endif #ifndef __OS2__ if (new_ptr == NULL) exit(-1); #endif #ifdef LIB_DEBUG lib_debug_free(ptr, 1, 0); lib_debug_alloc(new_ptr, size, 1); #endif return new_ptr; }
/* Like realloc, but abort if not enough memory is available. */ void *lib_realloc(void *ptr, size_t size) { #ifdef LIB_DEBUG void *new_ptr = lib_debug_libc_realloc(ptr, size); #else void *new_ptr = realloc(ptr, size); #endif #ifndef __OS2__ if (new_ptr == NULL) { fprintf(stderr, "error: lib_realloc failed\n"); exit(-1); } #endif #ifdef LIB_DEBUG lib_debug_free(ptr, 1, 0); lib_debug_alloc(new_ptr, size, 1); #endif return new_ptr; }