From 37597494666e6968ba7b2d946cdaf357069ec0b3 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 24 Sep 2014 10:53:52 +0200 Subject: [PATCH] Simplify QOfonoDataConnectionManagerInterface::getProperty() Make getProperties() return a reference and directly call value() on it. Almost is a tail-call now, if it wasn't inlined and if the dtor of the default argument didn't have to be called. Saves 288bytes in text size even so. Change-Id: Ie841501c1ce1379ca928f7474b90bc6487d77ab2 Reviewed-by: Valerio Valerio Reviewed-by: Lorn Potter --- src/plugins/bearer/connman/qofonoservice_linux.cpp | 7 ++----- src/plugins/bearer/connman/qofonoservice_linux_p.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp index ecf79101f0..fdd8a9c8d5 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux.cpp +++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp @@ -272,13 +272,10 @@ bool QOfonoDataConnectionManagerInterface::roamingAllowed() QVariant QOfonoDataConnectionManagerInterface::getProperty(const QString &property) { - QVariant var; - QVariantMap map = getProperties(); - var = map.value(property); - return var; + return getProperties().value(property); } -QVariantMap QOfonoDataConnectionManagerInterface::getProperties() +QVariantMap &QOfonoDataConnectionManagerInterface::getProperties() { if (propertiesMap.isEmpty()) { QList argumentList; diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h index f2d9e5351b..302d7543d4 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux_p.h +++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h @@ -155,7 +155,7 @@ public: Q_SIGNALS: void roamingAllowedChanged(bool); private: - QVariantMap getProperties(); + QVariantMap &getProperties(); QVariantMap propertiesMap; QVariant getProperty(const QString &); QStringList contextList;