]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: vars: store variable names for runtime access
authorHyeonggeun Oh <hyeonggeun.oh@plaintexting.com>
Tue, 13 Jan 2026 18:20:27 +0000 (03:20 +0900)
committerWilly Tarreau <w@1wt.eu>
Wed, 21 Jan 2026 09:44:19 +0000 (10:44 +0100)
commit95e8483b35f1fd8e80e88c5fce37df72e294cd31
treec3d434fa36c2a59acd77530b3532f79399f0f0a6
parent25564b6075b629cdb0f4355d7e0c69605f17e0a0
MINOR: vars: store variable names for runtime access

Currently, variable names are only used during parsing and are not
stored at runtime. This makes it impossible to iterate through
variables and retrieve their names.

This patch adds infrastructure to store variable names:
- Add 'name' and 'name_len' fields to var_desc structure
- Add 'name' field to var structure
- Add VDF_NAME_ALLOCATED flag to track memory ownership
- Store names in vars_fill_desc(), var_set(), vars_check_arg(),
  and parse_store()
- Free names in var_clear() and release_store_rule()
- Add ARGT_VAR handling in release_sample_arg() to free the
  allocated name when the flag is set

This prepares the ground for implementing dump_all_vars() in the
next commit.

Tested with:
  - ASAN-enabled build on Linux (TARGET=linux-glibc USE_OPENSSL=1
    ARCH_FLAGS="-g -fsanitize=address")
  - Regression tests: reg-tests/sample_fetches/vars.vtc
  - Regression tests: reg-tests/startup/default_rules.vtc
include/haproxy/vars-t.h
src/sample.c
src/vars.c