]> git.ipfire.org Git - thirdparty/haproxy.git/commit
CLEANUP: stick-table: uniformize the different action_inc_gpc*()
authorWilly Tarreau <w@1wt.eu>
Sun, 17 May 2026 21:03:35 +0000 (23:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 17 May 2026 21:10:27 +0000 (23:10 +0200)
commitb44d60eb42865ac0ea15acd016f0d6d2d852a9ea
treea983539cef78d0059e9e0375c90d1ce5b30285a0
parent015933794ec8a3a9fd86710482538ccaf51550c7
CLEANUP: stick-table: uniformize the different action_inc_gpc*()

While action_inc_gpc1() explicitly checks if s->stkctr or sess->stkctr
are set since 2.8 with commit 6c0117168 ("MEDIUM: stick-table: set the
track-sc limit at boottime via tune.stick-counters"), action_inc_gpc0()
and the generic action_inc_gpc() still stuck to the old approach of not
checking them, causing confusion when reviewing the code.

Upon closer inspection, the only case where the pointer may be NULL is
when global.tune.nb_stk_ctr is zero, which happens when the global
section contains "tune.stick-counters 0". However in this case, the
config parser "parse_inc_gpc()" will reject any reference to any stick
counter, so in theory there is no problem.

Regardless, the difference of treatment between sibling functions remains
confusing and the check is cheap, so let's generalize it, it will save a
future reader from the need to inspect stream_new() and session_new().
src/stick_table.c