MCPcopy Create free account
hub / github.com/codr7/hacktical-c / hc_vsprintf

Function hc_vsprintf

dynamic/dynamic.c:149–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149char *hc_vsprintf(const char *format, va_list args) {
150 va_list tmp_args;
151 va_copy(tmp_args, args);
152 int len = vsnprintf(NULL, 0, format, tmp_args);
153 va_end(tmp_args);
154
155 if (len < 0) {
156 hc_throw("Formatting '%s' failed: %d", format, errno);
157 }
158
159 len++;
160 char *out = malloc(len);
161 vsnprintf(out, len, format, args);
162 return out;
163}

Callers 1

hc_vprintfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected