Skip to content

Commit 44e22db

Browse files
committed
Merge pull request #991 from jeffhostetler/jeffhostetler/string_list_realloc
string-list: use ALLOC_GROW macro when reallocing string_list
2 parents 46a01c8 + b33d007 commit 44e22db

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

string-list.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ static int add_entry(int insert_at, struct string_list *list, const char *string
4141
if (exact_match)
4242
return -1 - index;
4343

44-
if (list->nr + 1 >= list->alloc) {
45-
list->alloc += 32;
46-
REALLOC_ARRAY(list->items, list->alloc);
47-
}
44+
if (list->nr + 1 >= list->alloc)
45+
ALLOC_GROW(list->items, list->nr+1, list->alloc);
4846
if (index < list->nr)
4947
memmove(list->items + index + 1, list->items + index,
5048
(list->nr - index)

0 commit comments

Comments
 (0)