]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
YaHTTP: Fix a few 'copy instead of move' warnings from Coverity
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Nov 2023 11:07:35 +0000 (12:07 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Nov 2023 11:07:35 +0000 (12:07 +0100)
ext/yahttp/yahttp/cookie.hpp
ext/yahttp/yahttp/reqresp.cpp
ext/yahttp/yahttp/router.cpp
ext/yahttp/yahttp/utility.hpp

index aa5359b1a720de3de1522fba0e3c9335fdadd02c..9e50d8bb3919a10dcc36f35a66b2d9648d3e0214 100644 (file)
@@ -118,7 +118,7 @@ namespace YaHTTP {
         if (s.find("=") != std::string::npos)
           keyValuePair(s, k, v);
         else
-          k = s;
+          k = std::move(s);
         if (k == "expires") {
           DateTime dt;
           dt.parseCookie(v);
index e5f9c95eccd93bfbf9db5acacfdbf2b8240c949a..a96def6e0d07ea81e6c2f184915f24e916e5fd21 100644 (file)
@@ -136,7 +136,7 @@ namespace YaHTTP {
           if (target->headers.find(key) != target->headers.end()) {
             target->headers[key] = target->headers[key] + ";" + value;
           } else {
-            target->headers[key] = value;
+            target->headers[key] = std::move(value);
           }
         }
       }
index 18ea9b6fcffef45a5230c32dd7407c889c4eb65a..90612ad8ec62d80f0824895d1204ce8e6de0756d 100644 (file)
@@ -88,10 +88,10 @@ namespace YaHTTP {
       funcptr::tie(p1,p2) = i->second;
       std::string value(req->url.path.begin() + p1, req->url.path.begin() + p2);
       value = Utility::decodeURL(value);
-      req->parameters[i->first] = value;
+      req->parameters[i->first] = std::move(value);
     }
 
-    req->routeName = rname;
+    req->routeName = std::move(rname);
 
     return true;
   };
index 23e6b8a59dd5375fa2dceac686a437d8e0df53a8..1d5e41efea83faedfaebfbb8c5192897fb48b382 100644 (file)
@@ -392,7 +392,7 @@ namespace YaHTTP {
         }
         key = decodeURL(key);
         value = decodeURL(value);
-        parameter_map[key] = value;
+        parameter_map[key] = std::move(value);
         if (nextpos == std::string::npos) {
           // no more parameters left
           break;