]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Apply performance advices from cppcheck
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 8 Sep 2021 14:51:01 +0000 (16:51 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 13 Sep 2021 13:34:34 +0000 (15:34 +0200)
I'm pretty sure the compiler is smart enough to do that by itself,
but it does not hurt and makes the warnings go away.

pdns/dnsdist-rings.hh
pdns/lock.hh

index bc424a35c089a95a0a656a03cdc9635133be427c..e8c118ba5c5a06a8eb45591d6b66543b9c9f1b36 100644 (file)
@@ -124,13 +124,13 @@ struct Rings {
         return;
       }
       if (d_keepLockingStats) {
-        d_deferredQueryInserts++;
+        ++d_deferredQueryInserts;
       }
     }
 
     /* out of luck, let's just wait */
     if (d_keepLockingStats) {
-      d_blockingResponseInserts++;
+      ++d_blockingResponseInserts;
     }
     auto& shard = getOneShard();
     auto lock = shard->queryRing.lock();
@@ -147,13 +147,13 @@ struct Rings {
         return;
       }
       if (d_keepLockingStats) {
-        d_deferredResponseInserts++;
+        ++d_deferredResponseInserts;
       }
     }
 
     /* out of luck, let's just wait */
     if (d_keepLockingStats) {
-      d_blockingResponseInserts++;
+      ++d_blockingResponseInserts;
     }
     auto& shard = getOneShard();
     auto lock = shard->respRing.lock();
index 1b60d46a5e315bbba8b7a6498407a3983b88dd57..2bef0b92adde8bedb46b2d6da7ba78bd7eda47ec 100644 (file)
@@ -110,9 +110,8 @@ public:
 
   ReadLock(const ReadLock& rhs) = delete;
   ReadLock& operator=(const ReadLock& rhs) = delete;
-  ReadLock(ReadLock&& rhs)
+  ReadLock(ReadLock&& rhs) : d_lock(std::move(rhs.d_lock))
   {
-    d_lock = std::move(rhs.d_lock);
   }
 
 private:
@@ -136,9 +135,8 @@ public:
 
   WriteLock(const WriteLock& rhs) = delete;
   WriteLock& operator=(const WriteLock& rhs) = delete;
-  WriteLock(WriteLock&& rhs)
+  WriteLock(WriteLock&& rhs) : d_lock(std::move(rhs.d_lock))
   {
-    d_lock = std::move(rhs.d_lock);
   }
 
 private: