]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: ot: use the item API for the variables trees
authorMiroslav Zagorac <mzagorac@haproxy.com>
Thu, 25 Sep 2025 22:13:12 +0000 (00:13 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 13 Apr 2026 07:23:30 +0000 (09:23 +0200)
In flt_ot_vars_scope_dump(), switched from cebu64_first()/cebu64_next() to
cebu64_imm_first()/cebu64_imm_next() for iterating the variable name trees.
Since this function only reads variables under a read lock, the immutable
traversal API is the correct choice.  Also updated the container_of()
member from 'node' to 'name_node' to match the current struct var layout.

addons/ot/src/vars.c

index 5030bc4121b8547159601db4c30e02d7e3fb0cf2..e0c6923c4d41ba7d7163e9f2a57122794362b84a 100644 (file)
@@ -46,10 +46,10 @@ static void flt_ot_vars_scope_dump(struct vars *vars, const char *scope)
 
        vars_rdlock(vars);
        for (i = 0; i < VAR_NAME_ROOTS; i++) {
-               struct ceb_node *node = cebu64_first(&(vars->name_root[i]));
+               struct ceb_node *node = cebu64_imm_first(&(vars->name_root[i]));
 
-               for ( ; node != NULL; node = cebu64_next(&(vars->name_root[i]), node)) {
-                       struct var *var = container_of(node, struct var, node);
+               for ( ; node != NULL; node = cebu64_imm_next(&(vars->name_root[i]), node)) {
+                       struct var *var = container_of(node, struct var, name_node);
 
                        FLT_OT_DBG(2, "'%s.%016" PRIx64 "' -> '%.*s'", scope, var->name_hash, (int)b_data(&(var->data.u.str)), b_orig(&(var->data.u.str)));
                }