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

Function join_segments

src/pipeline/fqn.c:36–62  ·  view source on GitHub ↗

Build a dot-joined string from segments. Returns heap-allocated string. */

Source from the content-addressed store, hash-verified

34
35/* Build a dot-joined string from segments. Returns heap-allocated string. */
36static char *join_segments(const char **segments, int count) {
37 if (count == 0) {
38 return strdup("");
39 }
40 size_t total = 0;
41 for (int i = 0; i < count; i++) {
42 total += strlen(segments[i]);
43 if (i > 0) {
44 total++; /* dot separator */
45 }
46 }
47 char *result = malloc(total + SKIP_ONE);
48 if (!result) {
49 return NULL;
50 }
51 char *p = result;
52 for (int i = 0; i < count; i++) {
53 if (i > 0) {
54 *p++ = '.';
55 }
56 size_t len = strlen(segments[i]);
57 memcpy(p, segments[i], len);
58 p += len;
59 }
60 *p = '\0';
61 return result;
62}
63
64/* Strip file extension from the last path component. */
65static void strip_file_extension(char *path) {

Callers 2

cbm_pipeline_fqn_computeFunction · 0.85
cbm_pipeline_fqn_folderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected