Merge pull request #991 from jeffhostetler/jeffhostetler/string_list_realloc

string-list: use ALLOC_GROW macro when reallocing string_list
This commit is contained in:
Johannes Schindelin
2017-04-12 21:12:10 +02:00

View File

@@ -41,10 +41,8 @@ static int add_entry(int insert_at, struct string_list *list, const char *string
if (exact_match) if (exact_match)
return -1 - index; return -1 - index;
if (list->nr + 1 >= list->alloc) { if (list->nr + 1 >= list->alloc)
list->alloc += 32; ALLOC_GROW(list->items, list->nr+1, list->alloc);
REALLOC_ARRAY(list->items, list->alloc);
}
if (index < list->nr) if (index < list->nr)
memmove(list->items + index + 1, list->items + index, memmove(list->items + index + 1, list->items + index,
(list->nr - index) (list->nr - index)