From: Aurelien DARRAGON Date: Thu, 30 Mar 2023 10:17:47 +0000 (+0200) Subject: BUG/MINOR: event_hdl: don't waste 1 event subtype slot X-Git-Tag: v2.8-dev8~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8273bfc63903eb2ca222a4a819d2284177567fdd;p=thirdparty%2Fhaproxy.git BUG/MINOR: event_hdl: don't waste 1 event subtype slot ESUB_INDEX(n) index macro is used exclusively with n > 0 Fixing it so that it starts numbering at 1 instead of 2. This way, we don't waste a subtype slot in event_hdl_sub_type struct, and we comply with the structure comments about max supported event subtypes (currently set at 16). If 68e692da0 ("MINOR: event_hdl: add event handler base api") is being backported, then this commit should be backported with it. --- diff --git a/include/haproxy/event_hdl-t.h b/include/haproxy/event_hdl-t.h index 308f67016e..b8ef61a102 100644 --- a/include/haproxy/event_hdl-t.h +++ b/include/haproxy/event_hdl-t.h @@ -229,7 +229,7 @@ struct event_hdl_sub { /* TODO: atomic_call_counter for stats?! */ }; -#define ESUB_INDEX(n) (1 << n) +#define ESUB_INDEX(n) (1 << (n - 1)) #define EVENT_HDL_SUB_TYPE(_family, _type) ((struct event_hdl_sub_type){ .family = _family, .subtype = ESUB_INDEX(_type) }) #define EVENT_HDL_SUB_FAMILY(_family) ((struct event_hdl_sub_type){ .family = _family, .subtype = ~0 })