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

Function strbuf_vappendf

util/strbuf.c:122–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void strbuf_vappendf(strbuf *buf, const char *fmt, va_list args)
123{
124 char s[1];
125 int len;
126 char *out;
127
128 len = vsnprintf(s, 1, fmt, args);
129 if (len <= 0) {
130 return;
131 }
132 len++;
133 out = malloc(len);
134 if (out == NULL) {
135 logmsg(LOGMSG_FATAL, "%s: memory allocation failed\n", __func__);
136 abort();
137 }
138 vsnprintf(out, len, fmt, args);
139 strbuf_append(buf, out);
140 free(out);
141}
142
143void strbuf_appendf(strbuf *buf, const char *fmt, ...)
144{

Callers

nothing calls this directly

Calls 4

mallocFunction · 0.85
freeFunction · 0.85
logmsgFunction · 0.70
strbuf_appendFunction · 0.70

Tested by

no test coverage detected