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

Function string_format

src/daemon/ipc.c:211–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211static 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
232static cbm_daemon_ipc_posix_publication_hook_fn g_posix_publication_hook_for_test;

Calls

no outgoing calls

Tested by

no test coverage detected