From: Fredrik Tolf Date: Sat, 31 Aug 2024 14:56:36 +0000 (+0200) Subject: ratequeue: Improve rehash implementation. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=54720222d4af3825cb1c63e52d824dda1e360e2b;p=ashd.git ratequeue: Improve rehash implementation. --- diff --git a/src/ratequeue.c b/src/ratequeue.c index c349f18..3d2e6d9 100644 --- a/src/ratequeue.c +++ b/src/ratequeue.c @@ -161,12 +161,11 @@ static void rehash(int nlen) nlen = SBUCKETS; new = sbuckets; } else { - new = szmalloc(sizeof(*new) * (1 << nlen)); + new = smalloc(sizeof(*new) * (1 << nlen)); } if(nlen == hashlen) return; - if(new == sbuckets) - memset(sbuckets, 0, sizeof(sbuckets)); + memset(new, 0, sizeof(*new) * (1 << nlen)); assert(old != new); pl = 1 << hashlen; nl = 1 << nlen; m = nl - 1; for(i = 0; i < pl; i++) {