From: Michael Tremer Date: Wed, 9 Mar 2022 10:19:10 +0000 (+0000) Subject: country-list: Grow like AS list X-Git-Tag: 0.9.12~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7db88f1b6880794c3331a8d531ab2c26fd260b1d;p=people%2Fms%2Flibloc.git country-list: Grow like AS list Signed-off-by: Michael Tremer --- diff --git a/src/country-list.c b/src/country-list.c index 6c49533..4d5ef08 100644 --- a/src/country-list.c +++ b/src/country-list.c @@ -31,7 +31,11 @@ struct loc_country_list { size_t size; }; -static int loc_country_list_grow(struct loc_country_list* list, size_t size) { +static int loc_country_list_grow(struct loc_country_list* list) { + size_t size = list->elements_size * 2; + if (size < 1024) + size = 1024; + DEBUG(list->ctx, "Growing country list %p by %zu to %zu\n", list, size, list->elements_size + size); @@ -124,7 +128,7 @@ LOC_EXPORT int loc_country_list_append( // Check if we have space left if (list->size >= list->elements_size) { - int r = loc_country_list_grow(list, 64); + int r = loc_country_list_grow(list); if (r) return r; }