On Tue, 2 Jun 2026 15:17:08 +0200
Laurent Vivier
Since 260075bde769 ("tcp, udp, fwd: Run all port scanning from a single timer"), CALL_PROTO_HANDLER() has only one user (tcp), so inline it at the call site and remove the macro.
Merge tcp_timer() into tcp_defer_handler(), moving the timer interval check there, matching the pattern used by flow_defer_handler() and fwd_scan_ports_timer().
The weak declaration and null check for tcp_defer_handler are also dropped as the function is always defined.
Signed-off-by: Laurent Vivier
--- passt.c | 23 ++--------------------- tcp.c | 22 ++++++++++------------ tcp.h | 3 +-- 3 files changed, 13 insertions(+), 35 deletions(-) diff --git a/passt.c b/passt.c index b6fc12d4ed81..b3f806b9a15e 100644 --- a/passt.c +++ b/passt.c @@ -101,27 +101,8 @@ struct passt_stats { */ static void post_handler(struct ctx *c, const struct timespec *now) { -#define CALL_PROTO_HANDLER(lc, uc) \ - do { \ - extern void \ - lc ## _defer_handler (struct ctx *c) \ - __attribute__ ((weak)); \ - \ - if (!c->no_ ## lc) { \ - if (lc ## _defer_handler) \ - lc ## _defer_handler(c); \ - \ - if (timespec_diff_ms((now), &c->lc.timer_run) \ - >= uc ## _TIMER_INTERVAL) { \ - lc ## _timer(c, now); \ - c->lc.timer_run = *now; \ - } \ - } \
My beautiful write-only macro crap going away... :( Applied. -- Stefano