add " called " to end of buf, truncating if necessary */
| 555 | |
| 556 | /* add "<pfx> called <sfx>" to end of buf, truncating if necessary */ |
| 557 | staticfn void |
| 558 | xcalled( |
| 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 | |
| 574 | char * |
| 575 | xname(struct obj *obj) |
no test coverage detected