From a4301807428dd4389d9bb43bffea171f5ca3c2ae Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 13 Oct 2025 16:44:15 +0200 Subject: [PATCH] iputils: Make static addresses static in `ComboAddress::isUnspecified` Prevent having to instantiate them again and again, as suggested by Otto. Signed-off-by: Remi Gacogne --- pdns/iputils.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdns/iputils.hh b/pdns/iputils.hh index c567f78950..a533ab3c1b 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -286,9 +286,9 @@ union ComboAddress [[nodiscard]] bool isUnspecified() const { + static const ComboAddress unspecifiedV4("0.0.0.0:0"); + static const ComboAddress unspecifiedV6("[::]:0"); const auto compare = ComboAddress::addressOnlyEqual(); - const ComboAddress unspecifiedV4("0.0.0.0:0"); - const ComboAddress unspecifiedV6("[::]:0"); return compare(*this, unspecifiedV4) || compare(*this, unspecifiedV6); } -- 2.47.3