put the most recently allocated buffer back if possible */
| 147 | |
| 148 | /* put the most recently allocated buffer back if possible */ |
| 149 | staticfn void |
| 150 | releaseobuf(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 |
no outgoing calls
no test coverage detected