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

Function path_append_segment

src/pipeline/fqn.c:212–224  ·  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

210 * normalized slash-separated path. Adds a '/' separator when needed,
211 * returns false if the buffer would overflow. */
212static bool path_append_segment(char *buf, size_t buf_size, const char *seg, size_t seg_len) {
213 size_t cur = strlen(buf);
214 size_t need = cur + (cur > 0 ? FQN_SEP_LEN : 0) + seg_len + FQN_NUL_LEN;
215 if (need > buf_size) {
216 return false;
217 }
218 if (cur > 0) {
219 buf[cur++] = '/';
220 }
221 memcpy(buf + cur, seg, seg_len);
222 buf[cur + seg_len] = '\0';
223 return true;
224}
225
226/* Pop the last segment from a mutable slash-separated path. */
227static 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