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
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user