void *debug_xrealloc(const char *file, int line, void *old, int size) { void *newp = debug_realloc(file, line, old, size); if (!newp) abort(); return newp; }
static void growingListAdd(GrowingList* pList, size_t objSize) { if (pList->count == pList->alloc) { size_t oldsize = pList->alloc * objSize; pList->alloc += PAGESIZE / objSize; size_t size = pList->alloc * objSize; pList->data = debug_realloc(pList->data, size, oldsize); } pList->count++; }
void *shell_reallocdebug(const char *file, unsigned int line, void *ptr, unsigned long size) { void *newptr; if(ptr == NULL) return shell_allocdebug(file, line, size); newptr = debug_realloc(file, line, ptr, size); /* exit if failed */ if(newptr == NULL) { shell_error("realloc"); exit(1); } /* return pointer otherwise */ return newptr; }
void * _Realloc( char *file, int line, void *p, size_t s ) { if (p == NULL) p = debug_malloc(file, line, s); else p = debug_realloc(file, line, p, s); if (p == NULL) { md_perror(""); md_exit(NULL, 1); } return (p); }