]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
reference instead of copy, and move some code for clarity
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 19 Jan 2024 13:41:18 +0000 (14:41 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 19 Jan 2024 13:41:18 +0000 (14:41 +0100)
pdns/lua-record.cc

index 705fb3161fde6ab70258ad70ce1eca3497050485..fb69c2763d13abb3a5d79028563cb1ac8c030aab 100644 (file)
@@ -736,9 +736,7 @@ static void setupLuaRecords(LuaContext& lua) // NOLINT(readability-function-cogn
           return allZerosIP;
         }
       } else if (!parts.empty()) {
-        // either hex string, or 12-13-14-15
-        vector<string> ip_parts;
-        auto input = parts[0];
+        auto& input = parts.at(0);
 
         // allow a word without - in front, as long as it does not contain anything that could be a number
         size_t nonhexprefix = strcspn(input.c_str(), "0123456789abcdefABCDEF");
@@ -746,6 +744,9 @@ static void setupLuaRecords(LuaContext& lua) // NOLINT(readability-function-cogn
           input = input.substr(nonhexprefix);
         }
 
+        // either hex string, or 12-13-14-15
+        vector<string> ip_parts;
+
         stringtok(ip_parts, input, "-");
         unsigned int x1, x2, x3, x4;
         if (ip_parts.size() >= 4) {