OSDN Git Service

avoid temporaries in QAtomicInt and QAtomicPointer
authorIvailo Monev <xakepa10@gmail.com>
Sun, 8 Nov 2020 22:21:54 +0000 (00:21 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 8 Nov 2020 22:21:54 +0000 (00:21 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/core/thread/qatomic.h

index 8e08d80..d5417cc 100644 (file)
@@ -52,14 +52,11 @@ class Q_CORE_EXPORT QAtomicInt
       }
 
       inline QAtomicInt(const QAtomicInt &other) {
-         int data = other.load();
-         store(data);
+         store(other.load());
       }
 
       inline QAtomicInt &operator=(const QAtomicInt &other) {
-         int data = other.load();
-         store(data);
-
+         store(other.load());
          return *this;
       }
 
@@ -159,14 +156,11 @@ class Q_CORE_EXPORT QAtomicPointer
       }
 
       inline QAtomicPointer(const QAtomicPointer<T> &other) {
-         T *data = other.load();
-         store(data);
+         store(other.load());
       }
 
       inline QAtomicPointer<T> &operator=(const QAtomicPointer<T> &other) {
-         T *data = other.load();
-         store(data);
-
+         store(other.load());
          return *this;
       }