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

Function macronamelimit

util/makedefs.c:2178–2192  ·  view source on GitHub ↗

limit a name to 30 characters (26 if "xyz_" prefix precedes it) */

Source from the content-addressed store, hash-verified

2176
2177/* limit a name to 30 characters (26 if "xyz_" prefix precedes it) */
2178static char *
2179macronamelimit(char *name, int pref)
2180{
2181 static char macronametemp[32];
2182 unsigned len = pref ? 26 : 30;
2183
2184#if 0 /* avoid potential warning about strncpy() not guaranteeing '\0' */
2185 (void) strncpy(macronametemp, name, len);
2186 macronametemp[len] = '\0';
2187#else /* strncat() does guarantee terminating '\0' */
2188 macronametemp[0] = '\0';
2189 (void) strncat(macronametemp, name, len);
2190#endif
2191 return macronametemp;
2192}
2193
2194/* obsolete */
2195void

Callers 1

do_objsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected