From b5067a972c6bbbe52344c76aed15f437f9bb5cdd Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Wed, 11 Jun 2025 19:41:38 +0200 Subject: [PATCH] BUILD: listener: fix 'for' loop inline variable declaration commit 16eb0fab3 ("MAJOR: counters: dispatch counters over thread groups") introduced a build regression on some compilers: src/listener.c: In function 'listener_accept': src/listener.c:1095:3: error: 'for' loop initial declarations are only allowed in C99 mode for (int it = 0; it < global.nbtgroups; it++) ^ src/listener.c:1095:3: note: use option -std=c99 or -std=gnu99 to compile your code src/listener.c:1101:4: error: 'for' loop initial declarations are only allowed in C99 mode for (int it = 0; it < global.nbtgroups; it++) { ^ make: *** [src/listener.o] Error 1 make: *** Waiting for unfinished jobs.... Let's fix that. No backport needed --- src/listener.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/listener.c b/src/listener.c index 020b274ea..14fb55f1a 100644 --- a/src/listener.c +++ b/src/listener.c @@ -1091,14 +1091,15 @@ void listener_accept(struct listener *l) #endif if (p && p->fe_sps_lim) { int max = 0; + int it; - for (int it = 0; it < global.nbtgroups; it++) + for (it = 0; it < global.nbtgroups; it++) max += freq_ctr_remain(&p->fe_counters.shared->tg[it]->sess_per_sec, p->fe_sps_lim, 0); if (unlikely(!max)) { unsigned int min_wait = 0; - for (int it = 0; it < global.nbtgroups; it++) { + for (it = 0; it < global.nbtgroups; it++) { unsigned int cur_wait = next_event_delay(&p->fe_counters.shared->tg[it]->sess_per_sec, p->fe_sps_lim, 0); if (!it || cur_wait < min_wait) min_wait = cur_wait;