]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
iputils: Make static addresses static in `ComboAddress::isUnspecified`
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 13 Oct 2025 14:44:15 +0000 (16:44 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Oct 2025 09:08:47 +0000 (11:08 +0200)
Prevent having to instantiate them again and again, as suggested by
Otto.

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
(cherry picked from commit a4301807428dd4389d9bb43bffea171f5ca3c2ae)

pdns/iputils.hh

index bf59741f4cd55e12869e33090bdb507b8426fea9..fe2e61b3726483fa613b0e2b3775c57de13d2c49 100644 (file)
@@ -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);
   }