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

Function string_format

src/daemon/ipc.c:76–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Calls

no outgoing calls

Tested by

no test coverage detected