diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2022-12-08 00:26:46 -0500 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2022-12-10 11:58:14 -0500 |
commit | c412bb59ce1488347a9f4d6d55e42de3f8567956 (patch) | |
tree | 0be4efd67374e6856abb35252847c5166a710629 /src/mod_magnet_cache.c | |
parent | 0318ef7b64768cc937ee944da445248376793cd3 (diff) | |
download | lighttpd-git-c412bb59ce1488347a9f4d6d55e42de3f8567956.tar.gz |
[multiple] employ ck_realloc_u32() shared code
employ ck_realloc_u32() shared code to slightly reduce code size
Diffstat (limited to 'src/mod_magnet_cache.c')
-rw-r--r-- | src/mod_magnet_cache.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/mod_magnet_cache.c b/src/mod_magnet_cache.c index 3a9ac5f0..81ddf4e6 100644 --- a/src/mod_magnet_cache.c +++ b/src/mod_magnet_cache.c @@ -102,11 +102,8 @@ static script *script_cache_new_script(script_cache * const cache, const buffer { script * const sc = script_init(); - if (cache->used == cache->size) { - cache->size += 16; - cache->ptr = realloc(cache->ptr, cache->size * sizeof(*(cache->ptr))); - force_assert(cache->ptr); - } + if (!(cache->used & (16-1))) + ck_realloc_u32((void **)&cache->ptr,cache->used,16,sizeof(*cache->ptr)); cache->ptr[cache->used++] = sc; buffer_copy_buffer(&sc->name, name); |