From eabe477ad2d57da5477deafc93319a1f02bd7b6f Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Mon, 27 Nov 2023 14:49:33 +0100 Subject: [PATCH] BUILD: map: fix build warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit field pointer of pat_ref_elt structure has been by a zero-length array. As such, it's now unneeded to check for NULL address before printing it. This type conversion was done in the following commit : 3ac9912837118a81f3291e106ce9a7c4be6c934f OPTIM: pattern: save memory and time using ebst instead of ebis The current patch is mandatory to fix the following GCC warning : CC src/map.o src/map.c: In function ‘cli_io_handler_map_lookup’: src/map.c:549:54: error: the comparison will always evaluate as ‘true’ for the address of ‘pattern’ will never be NULL [-Werror=address] 549 | if (pat->ref && pat->ref->pattern) | No need to backport it unless the above commit is. --- src/map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/map.c b/src/map.c index 3bd3de5..ba7fd81 100644 --- a/src/map.c +++ b/src/map.c @@ -546,13 +546,13 @@ static int cli_io_handler_map_lookup(struct appctx *appctx) /* display pattern */ if (ctx->display_flags == PAT_REF_MAP) { - if (pat->ref && pat->ref->pattern) + if (pat->ref) chunk_appendf(&trash, ", key=\"%s\"", pat->ref->pattern); else chunk_appendf(&trash, ", key=unknown"); } else { - if (pat->ref && pat->ref->pattern) + if (pat->ref) chunk_appendf(&trash, ", pattern=\"%s\"", pat->ref->pattern); else chunk_appendf(&trash, ", pattern=unknown"); -- 1.7.10.4