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

Function strbuf_appendf

util/strbuf.c:143–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143void strbuf_appendf(strbuf *buf, const char *fmt, ...)
144{
145 char s[1];
146 va_list args;
147 int len;
148 char *out;
149
150 va_start(args, fmt);
151 len = vsnprintf(s, 1, fmt, args);
152 va_end(args);
153 if (len <= 0) {
154 return;
155 }
156 len++;
157 out = malloc(len);
158 if (out == NULL) {
159 logmsg(LOGMSG_FATAL, "%s: memory allocation failed\n", __func__);
160 abort();
161 }
162 va_start(args, fmt);
163 vsnprintf(out, len, fmt, args);
164 va_end(args);
165 strbuf_append(buf, out);
166 free(out);
167}
168
169void strbuf_hex(strbuf *buf, void *tohex, int len)
170{

Callers 15

stackutil_get_stack_strFunction · 0.70
strbuf_hexFunction · 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
json_blobFunction · 0.50
json_recordFunction · 0.50

Calls 4

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

Tested by

no test coverage detected