MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / strbuf_append

Function strbuf_append

util/strbuf.c:57–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57void strbuf_append(strbuf *buf, const char *str)
58{
59 assert(buf != NULL);
60 size_t len = strlen(str);
61 if (buf->alloc < buf->len + len + 1) {
62 size_t inc = len >= STRBUF_INC ? len + 1 : STRBUF_INC;
63 buf->alloc += inc;
64 buf->buf = realloc(buf->buf, buf->alloc);
65 if (buf->buf == 0) {
66 logmsg(LOGMSG_FATAL, "%s: memory allocation failed\n", __func__);
67 abort();
68 }
69 }
70 strcat(buf->buf, str);
71 buf->len += len;
72}
73
74const char *strbuf_buf(const strbuf *buf)
75{

Callers 15

stackutil_get_stack_strFunction · 0.70
strbuf_vappendfFunction · 0.70
strbuf_appendfFunction · 0.70
get_stack_backtraceFunction · 0.50
comdb2CreateTriggerFunction · 0.50
csc2_append_fkey_consFunction · 0.50
csc2_append_check_consFunction · 0.50
format_csc2Function · 0.50
escape_exprFunction · 0.50
retrieve_schemaFunction · 0.50
comdb2AddIndexIntFunction · 0.50
systbl_connectFunction · 0.50

Calls 2

reallocFunction · 0.85
logmsgFunction · 0.70

Tested by

no test coverage detected