First index whose path is >= key. */
| 141 | |
| 142 | /* First index whose path is >= key. */ |
| 143 | static int sh_lower_bound(const sh_paths_t *v, const char *key) { |
| 144 | int lo = 0; |
| 145 | int hi = v->count; |
| 146 | while (lo < hi) { |
| 147 | int mid = lo + (hi - lo) / PAIR_LEN; |
| 148 | if (strcmp(v->items[mid], key) < 0) { |
| 149 | lo = mid + SKIP_ONE; |
| 150 | } else { |
| 151 | hi = mid; |
| 152 | } |
| 153 | } |
| 154 | return lo; |
| 155 | } |
| 156 | |
| 157 | static bool sh_paths_has(const sh_paths_t *v, const char *p) { |
| 158 | int i = sh_lower_bound(v, p); |
no outgoing calls
no test coverage detected