MCPcopy Index your code
hub / github.com/NetHack/NetHack / nhalloc

Function nhalloc

src/alloc.c:151–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151long *
152nhalloc(unsigned int lth, const char *file, int line)
153{
154 long *ptr = alloc(lth);
155
156 if (!tried_heaplog)
157 heapmon_init();
158 if (heaplog)
159 (void) fprintf(heaplog, "+%5u %s %4d %s\n", lth,
160 fmt_ptr((genericptr_t) ptr), line, file);
161 /* potential panic in alloc() was deferred til here */
162 if (!ptr)
163 panic("Cannot get %u bytes, line %d of %s", lth, line, file);
164
165 return ptr;
166}
167
168/* re_alloc() with heap logging; we lack access to the old alloc size */
169long *

Callers 1

nhdupstrFunction · 0.85

Calls 5

heapmon_initFunction · 0.85
fprintfFunction · 0.85
fmt_ptrFunction · 0.85
allocFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected