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

Function free_CapMons

src/rumors.c:938–953  ·  view source on GitHub ↗

release memory allocated for the list of capitalized monster type names */

Source from the content-addressed store, hash-verified

936
937/* release memory allocated for the list of capitalized monster type names */
938void
939free_CapMons(void)
940{
941 /* note: some elements of CapMons[] are string literals from
942 mons[].pmnames[] and should not be freed, others are dynamically
943 allocated copies of hallucinatory monster names and should be freed */
944 if (CapMons) {
945 unsigned idx;
946
947 /* skip 0..MonstCnt-1, free MonstCnt..(MonstCnt+BogonCnt-1) */
948 for (idx = CapMonstCnt; idx < CapMonSiz - 1; ++idx)
949 free((genericptr_t) CapMons[idx]); /* cast: discard 'const' */
950 free((genericptr_t) CapMons), CapMons = (const char **) 0;
951 }
952 CapMonSiz = 0;
953}
954#endif /* !SFCTOOL */
955
956/*rumors.c*/

Callers 2

freedynamicdataFunction · 0.85
init_CapMonsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected