| 118 | } |
| 119 | |
| 120 | static size_t changes_find(const cbm_changes_t *changes, const unsigned char *path, size_t length) { |
| 121 | size_t low = 0; |
| 122 | size_t high = changes->count; |
| 123 | while (low < high) { |
| 124 | size_t middle = low + (high - low) / 2; |
| 125 | const cbm_change_file_t *file = &changes->files[middle]; |
| 126 | int order = changes_path_compare(file->path, file->path_length, path, length); |
| 127 | if (!order) { |
| 128 | return middle; |
| 129 | } |
| 130 | if (order < 0) { |
| 131 | low = middle + 1; |
| 132 | } else { |
| 133 | high = middle; |
| 134 | } |
| 135 | } |
| 136 | return SIZE_MAX; |
| 137 | } |
| 138 | |
| 139 | static bool changes_starts(changes_slice_t line, const char *prefix) { |
| 140 | size_t length = strlen(prefix); |
no test coverage detected