MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / string_format

Function string_format

src/daemon/ipc.c:83–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83static char *string_format(const char *format, ...) {
84 va_list args;
85 va_start(args, format);
86 va_list measure;
87 va_copy(measure, args);
88 int needed = vsnprintf(NULL, 0, format, measure);
89 va_end(measure);
90 if (needed < 0) {
91 va_end(args);
92 return NULL;
93 }
94 char *result = malloc((size_t)needed + 1);
95 if (!result || vsnprintf(result, (size_t)needed + 1, format, args) != needed) {
96 free(result);
97 result = NULL;
98 }
99 va_end(args);
100 return result;
101}
102
103#ifndef _WIN32
104static cbm_daemon_ipc_posix_publication_hook_fn g_posix_publication_hook_for_test;

Calls

no outgoing calls

Tested by

no test coverage detected