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

Function xcalled

src/objnam.c:557–572  ·  view source on GitHub ↗

add " called " to end of buf, truncating if necessary */

Source from the content-addressed store, hash-verified

555
556/* add "<pfx> called <sfx>" to end of buf, truncating if necessary */
557staticfn void
558xcalled(
559 char *buf, /* eos(obuf) or eos(&obuf[PREFIX]) */
560 int siz, /* BUFSZ or BUFSZ-PREFIX */
561 const char *pfx, /* usually class string, sometimes more specific */
562 const char *sfx) /* user assigned type name */
563{
564 int bufsiz = siz - 1 - (int) strlen(buf),
565 pfxlen = (int) (strlen(pfx) + sizeof " called " - sizeof "");
566
567 if (pfxlen > bufsiz)
568 panic("xcalled: not enough room for prefix (%d > %d)",
569 pfxlen, bufsiz);
570
571 Sprintf(eos(buf), "%s called %.*s", pfx, bufsiz - pfxlen, sfx);
572}
573
574char *
575xname(struct obj *obj)

Callers 2

obj_typenameFunction · 0.85
xname_flagsFunction · 0.85

Calls 2

eosFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected