Commit 7db88f1b authored by Michael Tremer's avatar Michael Tremer

country-list: Grow like AS list

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 635c344a
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment