From b5a85bd2fed2e9a55a7c7900a10ff9dc40c4b2ee Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 24 Sep 2014 13:22:31 +0200 Subject: [PATCH] sources: reallocate arrays in exponentially increasing sizes --- sources.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources.c b/sources.c index 1ab0a99..30d6144 100644 --- a/sources.c +++ b/sources.c @@ -207,7 +207,7 @@ SRC_Instance SRC_CreateNewInstance(uint32_t ref_id, SRC_Type type, SRC_SelectOpt if (n_sources == max_n_sources) { /* Reallocate memory */ - max_n_sources += 32; + max_n_sources = max_n_sources > 0 ? 2 * max_n_sources : 4; if (sources) { sources = ReallocArray(struct SRC_Instance_Record *, max_n_sources, sources); sort_list = ReallocArray(struct Sort_Element, 3*max_n_sources, sort_list);