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

Function cbm_path_dir

src/foundation/str_util.c:112–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112char *cbm_path_dir(CBMArena *a, const char *path) {
113 if (!path) {
114 return cbm_arena_strdup(a, ".");
115 }
116 const char *last_slash = NULL;
117 for (const char *p = path; *p; p++) {
118 if (*p == '/') {
119 last_slash = p;
120 }
121 }
122 if (!last_slash) {
123 return cbm_arena_strdup(a, ".");
124 }
125 return cbm_arena_strndup(a, path, (size_t)(last_slash - path));
126}
127
128bool cbm_str_starts_with(const char *s, const char *prefix) {
129 if (!s || !prefix) {

Callers 1

test_str_util.cFile · 0.85

Calls 2

cbm_arena_strdupFunction · 0.70
cbm_arena_strndupFunction · 0.70

Tested by

no test coverage detected