MCPcopy Create free account
hub / github.com/NetHack/NetHack / re_alloc

Function re_alloc

src/alloc.c:84–99  ·  view source on GitHub ↗

realloc() call that might get substituted by nhrealloc(p,n,file,line) */

Source from the content-addressed store, hash-verified

82
83/* realloc() call that might get substituted by nhrealloc(p,n,file,line) */
84long *
85re_alloc(long *oldptr, unsigned int newlth)
86{
87 long *newptr;
88
89 ForceAlignedLength(newlth);
90 newptr = (long *) realloc((genericptr_t) oldptr, (size_t) newlth);
91#ifndef MONITOR_HEAP
92 /* "extend to": assume it won't ever fail if asked to shrink */
93 if (newlth && !newptr)
94 panic("Memory allocation failure; cannot extend to %u bytes", newlth);
95#else
96 /* for #if MONITOR_HEAP, failure is handled in nhrealloc() */
97#endif
98 return newptr;
99}
100
101#ifdef HAS_PTR_FMT
102#define PTR_FMT "%p"

Callers 2

nhreallocFunction · 0.85
nhl_allocFunction · 0.85

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected