The paths of `v` below directory `dir` ("" = the root): [*lo, *hi). */
| 242 | |
| 243 | /* The paths of `v` below directory `dir` ("" = the root): [*lo, *hi). */ |
| 244 | static 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 | |
| 262 | static bool sh_dir_exists(const sh_index_t *ix, const char *dir) { |
| 263 | if (!dir[0]) { |
no test coverage detected