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

Function cni_root

src/mcp/test_impact_inventory_input.c:48–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48static char *cni_root(cni_context *c, const char *root) {
49 size_t length = 0;
50 for (;;) {
51 if (!cni_bytes(c, 1)) {
52 return NULL;
53 }
54 if (!root[length]) {
55 break;
56 }
57 if (length == CNI_PATH_MAX) {
58 cni_fail(c, CBM_INVENTORY_LIMIT);
59 return NULL;
60 }
61 length++;
62 }
63 if (!length) {
64 cni_fail(c, CBM_INVENTORY_INVALID);
65 return NULL;
66 }
67 char *copy = cni_alloc(c, &c->temporary, length + 1, 1);
68 return copy && cni_copy(c, copy, root, length + 1) ? copy : NULL;
69}
70
71static bool cni_file(cni_context *c, const cbm_pinned_tree_file_t *input,
72 cbm_inventory_file_t *output, size_t oid_width) {

Callers 1

cni_snapshotFunction · 0.85

Calls 4

cni_bytesFunction · 0.85
cni_failFunction · 0.85
cni_allocFunction · 0.85
cni_copyFunction · 0.85

Tested by

no test coverage detected