| 209 | } |
| 210 | |
| 211 | static char *string_format(const char *format, ...) { |
| 212 | va_list args; |
| 213 | va_start(args, format); |
| 214 | va_list measure; |
| 215 | va_copy(measure, args); |
| 216 | int needed = vsnprintf(NULL, 0, format, measure); |
| 217 | va_end(measure); |
| 218 | if (needed < 0) { |
| 219 | va_end(args); |
| 220 | return NULL; |
| 221 | } |
| 222 | char *result = malloc((size_t)needed + 1); |
| 223 | if (!result || vsnprintf(result, (size_t)needed + 1, format, args) != needed) { |
| 224 | free(result); |
| 225 | result = NULL; |
| 226 | } |
| 227 | va_end(args); |
| 228 | return result; |
| 229 | } |
| 230 | |
| 231 | #ifndef _WIN32 |
| 232 | static cbm_daemon_ipc_posix_publication_hook_fn g_posix_publication_hook_for_test; |
no outgoing calls
no test coverage detected