From: Remi Gacogne Date: Wed, 8 Sep 2021 14:51:01 +0000 (+0200) Subject: Apply performance advices from cppcheck X-Git-Tag: dnsdist-1.7.0-alpha1~23^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bcde8d5dccc8ee40343a56fc639fc86195e1bfa;p=thirdparty%2Fpdns.git Apply performance advices from cppcheck 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. --- diff --git a/pdns/dnsdist-rings.hh b/pdns/dnsdist-rings.hh index bc424a35c0..e8c118ba5c 100644 --- a/pdns/dnsdist-rings.hh +++ b/pdns/dnsdist-rings.hh @@ -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(); diff --git a/pdns/lock.hh b/pdns/lock.hh index 1b60d46a5e..2bef0b92ad 100644 --- a/pdns/lock.hh +++ b/pdns/lock.hh @@ -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: