summaryrefslogtreecommitdiff
path: root/string-list.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-04-23 22:07:47 -0700
committerJunio C Hamano <gitster@pobox.com>2017-04-23 22:07:47 -0700
commit8b6bba66633cf16807ae962e0b1126af164f0e78 (patch)
tree4723a0d3fa23ea218354c695e8ab8407503c3b9c /string-list.c
parenta2e2c046833be53e7599ee7fed5c45f16580ab37 (diff)
parent950a234cbd781021d69fcfaa40ab6fd258b1d917 (diff)
downloadgit-8b6bba66633cf16807ae962e0b1126af164f0e78.tar.gz
Merge branch 'jh/string-list-micro-optim'
The string-list API used a custom reallocation strategy that was very inefficient, instead of using the usual ALLOC_GROW() macro, which has been fixed. * jh/string-list-micro-optim: string-list: use ALLOC_GROW macro when reallocing string_list
Diffstat (limited to 'string-list.c')
-rw-r--r--string-list.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/string-list.c b/string-list.c
index 45016ad86d..003ca1879e 100644
--- a/string-list.c
+++ b/string-list.c
@@ -41,10 +41,7 @@ static int add_entry(int insert_at, struct string_list *list, const char *string
if (exact_match)
return -1 - index;
- if (list->nr + 1 >= list->alloc) {
- list->alloc += 32;
- REALLOC_ARRAY(list->items, list->alloc);
- }
+ ALLOC_GROW(list->items, list->nr+1, list->alloc);
if (index < list->nr)
memmove(list->items + index + 1, list->items + index,
(list->nr - index)