From 5dcd98de61514f701240712a9e6aa4e6e39e3f47 Mon Sep 17 00:00:00 2001 From: Levente Batuska Date: Sun, 1 Feb 2026 11:44:03 +0100 Subject: [PATCH] chore(env_var)!: rename DEFINE_ENV_VAR_STRING to DEFINE_ENV_VAR_STRING_LEN, DEFINE_ENV_VAR_STRING now checks len >= 1 --- include/cpputils/env_var.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/cpputils/env_var.h b/include/cpputils/env_var.h index b3a85c1..e000f00 100644 --- a/include/cpputils/env_var.h +++ b/include/cpputils/env_var.h @@ -52,7 +52,7 @@ class EnvVarRegistry { }; }; -#define DEFINE_ENV_VAR_STRING(name, DEFAULT_VALUE, MIN_LEN) \ +#define DEFINE_ENV_VAR_STRING_LEN(name, DEFAULT_VALUE, MIN_LEN) \ namespace EnvVars { \ struct name { \ static constexpr char const* DEFAULT = DEFAULT_VALUE; \ @@ -60,7 +60,7 @@ class EnvVarRegistry { static char const* GET() { \ auto c = std::getenv(#name); \ if (c) { \ - if (std::strlen(c) > MIN_LEN) { \ + if (std::strlen(c) >= MIN_LEN) { \ return c; \ } \ } \ @@ -71,6 +71,9 @@ class EnvVarRegistry { }; \ } +#define DEFINE_ENV_VAR_STRING(name, DEFAULT_VALUE) \ + DEFINE_ENV_VAR_STRING_LEN(name, DEFAULT_VALUE, 1) + #define DEFINE_ENV_VAR_INT(TYPE, name, DEFAULT_VALUE) \ namespace EnvVars { \ struct name { \