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

Function cbm_str_strip_ext

src/foundation/str_util.c:190–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190char *cbm_str_strip_ext(CBMArena *a, const char *path) {
191 if (!path) {
192 return NULL;
193 }
194 const char *dot = NULL;
195 const char *slash = NULL;
196 for (const char *p = path; *p; p++) {
197 if (*p == '.') {
198 dot = p;
199 }
200 if (*p == '/') {
201 slash = p;
202 }
203 }
204 if (!dot || (slash && dot < slash)) {
205 return cbm_arena_strdup(a, path);
206 }
207 return cbm_arena_strndup(a, path, (size_t)(dot - path));
208}
209
210char **cbm_str_split(CBMArena *a, const char *s, char delim, int *out_count) {
211 if (!s || !out_count) {

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