From a31fa55c320dcedbca2e979e3bf439278c076c4d Mon Sep 17 00:00:00 2001 From: Yves Mettier Date: Wed, 3 Oct 2012 11:27:46 +0200 Subject: [PATCH] the increment is defined as a constant (#define) and will not be a variable. So its names becomes uppercase. --- src/utils_cache.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/utils_cache.c b/src/utils_cache.c index 1c0815a9..c4be5ad1 100644 --- a/src/utils_cache.c +++ b/src/utils_cache.c @@ -578,8 +578,13 @@ int uc_get_names (char ***ret_names, cdtime_t **ret_times, size_t *ret_number) * Because realloc is time consuming, it's better to * realloc by blocks and not by units. * To see the difference, set this value to 1. + * + * To change this value at compile time: + * ./configure CFLAGS="-DLISTVAL_INCREASE=102400" */ - #define size_increment 102400 +#ifndef LISTVAL_INCREASE +# define LISTVAL_INCREASE 1024 +#endif int status = 0; @@ -602,7 +607,7 @@ int uc_get_names (char ***ret_names, cdtime_t **ret_times, size_t *ret_number) cdtime_t *tmp_times; if(number <= size_arrays) { - tmp_times = (cdtime_t *) realloc (times, sizeof (cdtime_t) * (size_arrays + size_increment)); + tmp_times = (cdtime_t *) realloc (times, sizeof (cdtime_t) * (size_arrays + LISTVAL_INCREASE)); if (tmp_times == NULL) { status = -1; @@ -614,14 +619,14 @@ int uc_get_names (char ***ret_names, cdtime_t **ret_times, size_t *ret_number) } if(number <= size_arrays) { - temp = (char **) realloc (names, sizeof (char *) * (size_arrays + size_increment)); + temp = (char **) realloc (names, sizeof (char *) * (size_arrays + LISTVAL_INCREASE)); if (temp == NULL) { status = -1; break; } names = temp; - size_arrays += size_increment; + size_arrays += LISTVAL_INCREASE; } names[number] = strdup (key); if (names[number] == NULL) -- 2.11.0