| 120 | } |
| 121 | |
| 122 | void 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 | |
| 143 | void strbuf_appendf(strbuf *buf, const char *fmt, ...) |
| 144 | { |
nothing calls this directly
no test coverage detected