diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-04-23 22:07:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-23 22:07:47 -0700 |
commit | 8b6bba66633cf16807ae962e0b1126af164f0e78 (patch) | |
tree | 4723a0d3fa23ea218354c695e8ab8407503c3b9c /string-list.c | |
parent | a2e2c046833be53e7599ee7fed5c45f16580ab37 (diff) | |
parent | 950a234cbd781021d69fcfaa40ab6fd258b1d917 (diff) | |
download | git-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.c | 5 |
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) |