Hello all,

In order for the function flt_ot_vars_scope_dump() to work, it is
necessary to take into account the changes made by the commits 47ec7c681
("OPTIM: vars: use a cebtree instead of a list for variable names") and
5d350d1e5 ("OPTIM: vars: use multiple name heads in the vars struct").

The function is only used if the OT_DEBUG=1 option is set when compiling
HAProxy.


Best regards,

-- 
Miroslav Zagorac
Senior Developer
From 7cd67c34cc1601d5e166e04133668da709197701 Mon Sep 17 00:00:00 2001
From: Miroslav Zagorac <mzago...@haproxy.com>
Date: Mon, 28 Oct 2024 15:31:55 +0100
Subject: [PATCH] BUILD: ot: use a cebtree instead of a list for variable names

In order for the function flt_ot_vars_scope_dump() to work, it is
necessary to take into account the changes made by the commits 47ec7c681
("OPTIM: vars: use a cebtree instead of a list for variable names") and
5d350d1e5 ("OPTIM: vars: use multiple name heads in the vars struct").

The function is only used if the OT_DEBUG=1 option is set when compiling
HAProxy.
---
 addons/ot/src/vars.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/addons/ot/src/vars.c b/addons/ot/src/vars.c
index e99bab16c..5030bc412 100644
--- a/addons/ot/src/vars.c
+++ b/addons/ot/src/vars.c
@@ -39,14 +39,21 @@
  */
 static void flt_ot_vars_scope_dump(struct vars *vars, const char *scope)
 {
-	const struct var *var;
+	int i;
 
 	if (vars == NULL)
 		return;
 
 	vars_rdlock(vars);
-	list_for_each_entry(var, &(vars->head), l)
-		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)));
+	for (i = 0; i < VAR_NAME_ROOTS; i++) {
+		struct ceb_node *node = cebu64_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);
+
+			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)));
+		}
+	}
 	vars_rdunlock(vars);
 }
 
-- 
2.45.2

Reply via email to