telepathy-qt: DBusError: Refactored == and != operators implementation.

Alexandr Akulich kaffeine at kemper.freedesktop.org
Fri May 6 15:26:59 UTC 2016


Module: telepathy-qt
Branch: master
Commit: db217f2e3bda97a6acf4c803efd0b887a85d382c
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=db217f2e3bda97a6acf4c803efd0b887a85d382c

Author: Alexandr Akulich <akulichalexander at gmail.com>
Date:   Wed Mar  2 10:09:16 2016 +0500

DBusError: Refactored == and != operators implementation.

---

 TelepathyQt/dbus-error.cpp | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/TelepathyQt/dbus-error.cpp b/TelepathyQt/dbus-error.cpp
index 47bd573..4964962 100644
--- a/TelepathyQt/dbus-error.cpp
+++ b/TelepathyQt/dbus-error.cpp
@@ -85,10 +85,9 @@ DBusError::~DBusError()
  */
 bool DBusError::operator==(const DBusError &other) const
 {
-    if (!isValid() || !other.isValid()) {
-        if (!isValid() && !other.isValid()) {
-            return true;
-        }
+    if (!isValid() && !other.isValid()) {
+        return true;
+    } else if (!isValid() || !other.isValid()) {
         return false;
     }
 
@@ -105,15 +104,7 @@ bool DBusError::operator==(const DBusError &other) const
  */
 bool DBusError::operator!=(const DBusError &other) const
 {
-    if (!isValid() || !other.isValid()) {
-        if (!isValid() && !other.isValid()) {
-            return false;
-        }
-        return true;
-    }
-
-    return mPriv->name != other.mPriv->name ||
-        mPriv->message != other.mPriv->message;
+    return !(*this == other);
 }
 
 /**



More information about the telepathy-commits mailing list