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

Function path_append_segment

src/pipeline/fqn.c:187–199  ·  view source on GitHub ↗

Append a single path segment to a mutable buffer that already holds a * normalized slash-separated path. Adds a '/' separator when needed, * returns false if the buffer would overflow. */

Source from the content-addressed store, hash-verified

185 * normalized slash-separated path. Adds a '/' separator when needed,
186 * returns false if the buffer would overflow. */
187static bool path_append_segment(char *buf, size_t buf_size, const char *seg, size_t seg_len) {
188 size_t cur = strlen(buf);
189 size_t need = cur + (cur > 0 ? FQN_SEP_LEN : 0) + seg_len + FQN_NUL_LEN;
190 if (need > buf_size) {
191 return false;
192 }
193 if (cur > 0) {
194 buf[cur++] = '/';
195 }
196 memcpy(buf + cur, seg, seg_len);
197 buf[cur + seg_len] = '\0';
198 return true;
199}
200
201/* Pop the last segment from a mutable slash-separated path. */
202static void path_pop_segment(char *buf) {

Callers 2

resolve_python_relativeFunction · 0.85
resolve_js_relativeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected