mirror of
https://github.com/git/git.git
synced 2026-01-26 18:44:50 +00:00
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:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user