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

Function releaseobuf

src/objnam.c:149–160  ·  view source on GitHub ↗

put the most recently allocated buffer back if possible */

Source from the content-addressed store, hash-verified

147
148/* put the most recently allocated buffer back if possible */
149staticfn void
150releaseobuf(char *bufp)
151{
152 /* caller may not know whether bufp is the most recently allocated
153 buffer; if it isn't, do nothing; note that because of the somewhat
154 obscure PREFIX handling for object name formatting by xname(),
155 the pointer our caller has and is passing to us might be into the
156 middle of an obuf rather than the address returned by nextobuf() */
157 if (bufp >= obufs[obufidx]
158 && bufp < obufs[obufidx] + sizeof obufs[obufidx]) /* obufs[][BUFSZ] */
159 obufidx = (obufidx - 1 + NUMOBUF) % NUMOBUF;
160}
161
162/* used by display_pickinv (invent.c, main whole-inventory routine) to
163 release each successive doname() result in order to try to avoid

Callers 11

maybereleaseobufFunction · 0.85
fruit_from_nameFunction · 0.85
xname_flagsFunction · 0.85
doname_baseFunction · 0.85
corpse_xnameFunction · 0.85
short_onameFunction · 0.85
simpleonamesFunction · 0.85
ansimpleonameFunction · 0.85
thesimpleonameFunction · 0.85
wishymatchFunction · 0.85
safe_qbufFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected