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

Function sh_range

src/pipeline/pass_shell.c:244–260  ·  view source on GitHub ↗

The paths of `v` below directory `dir` ("" = the root): [*lo, *hi). */

Source from the content-addressed store, hash-verified

242
243/* The paths of `v` below directory `dir` ("" = the root): [*lo, *hi). */
244static void sh_range(const sh_paths_t *v, const char *dir, char *key, size_t key_sz, int *lo,
245 int *hi) {
246 if (!dir[0]) {
247 key[0] = '\0';
248 *lo = 0;
249 *hi = v->count;
250 return;
251 }
252 snprintf(key, key_sz, "%s/", dir);
253 size_t kl = strlen(key);
254 *lo = sh_lower_bound(v, key);
255 int h = *lo;
256 while (h < v->count && strncmp(v->items[h], key, kl) == 0) {
257 h++;
258 }
259 *hi = h;
260}
261
262static bool sh_dir_exists(const sh_index_t *ix, const char *dir) {
263 if (!dir[0]) {

Callers 3

sh_dir_existsFunction · 0.85
sh_t_filesFunction · 0.85
sh_t_foundFunction · 0.85

Calls 1

sh_lower_boundFunction · 0.85

Tested by

no test coverage detected