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

Function cbm_path_ext

src/foundation/str_util.c:75–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75const char *cbm_path_ext(const char *path) {
76 if (!path) {
77 return "";
78 }
79 const char *dot = NULL;
80 const char *slash = NULL;
81 for (const char *p = path; *p; p++) {
82 if (*p == '.') {
83 dot = p;
84 }
85 if (*p == '/') {
86 slash = p;
87 }
88 }
89 /* dot must be after last slash and not at start of basename */
90 if (!dot) {
91 return "";
92 }
93 if (slash && dot < slash) {
94 return "";
95 }
96 return dot + SKIP_ONE;
97}
98
99const char *cbm_path_base(const char *path) {
100 if (!path) {

Callers 1

test_str_util.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected