diff options
Diffstat (limited to 'string-list.c')
-rw-r--r-- | string-list.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/string-list.c b/string-list.c index 806b4c8723..a0cf0cfe88 100644 --- a/string-list.c +++ b/string-list.c @@ -16,7 +16,7 @@ static int get_entry_index(const struct string_list *list, const char *string, compare_strings_fn cmp = list->cmp ? list->cmp : strcmp; while (left + 1 < right) { - int middle = (left + right) / 2; + int middle = left + (right - left) / 2; int compare = cmp(string, list->items[middle].string); if (compare < 0) right = middle; |