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

Function alloc

src/alloc.c:65–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63long *nhrealloc(long *, unsigned int, const char *, int) NONNULL;
64#endif
65ATTRNORETURN extern void panic(const char *, ...) PRINTF_F(1, 2) NORETURN;
66
67long *
68alloc(unsigned int lth)
69{
70 genericptr_t ptr;
71
72 ForceAlignedLength(lth);
73 ptr = malloc(lth);
74#ifndef MONITOR_HEAP
75 if (!ptr)
76 panic("Memory allocation failure; cannot get %u bytes", lth);
77#else
78 /* for #if MONITOR_HEAP, failure is handled in nhalloc() */
79#endif
80 return (long *) ptr;
81}
82
83/* realloc() call that might get substituted by nhrealloc(p,n,file,line) */
84long *

Callers 15

restoptvalsFunction · 0.70
msgtype_addFunction · 0.70
add_autopickup_exceptionFunction · 0.70
all_options_menucolorsFunction · 0.70
next_optFunction · 0.70
savebonesFunction · 0.70
newebonesFunction · 0.70
nhallocFunction · 0.70
dupstrFunction · 0.70
dupstr_nFunction · 0.70
delayed_killerFunction · 0.70
restore_killersFunction · 0.70

Calls 1

panicFunction · 0.50

Tested by

no test coverage detected