Enable RVO (return value optimization).
authorCamila Ayres <hello@camilasan.com>
Wed, 3 Jul 2024 14:23:33 +0000 (16:23 +0200)
committerCamila Ayres <hello@camilasan.com>
Wed, 3 Jul 2024 14:32:11 +0000 (16:32 +0200)
Signed-off-by: Camila Ayres <hello@camilasan.com>
src/libsync/configfile.cpp

index 01e8df7af97357a7dba17bbac6702a115adced88..59629f91caec08f0a57e40d3221be460dfa6af31 100644 (file)
@@ -705,14 +705,15 @@ QString ConfigFile::defaultUpdateChannel() const
 
 QString ConfigFile::currentUpdateChannel() const
 {
+    auto updateChannel = defaultUpdateChannel();
     QSettings settings(configFile(), QSettings::IniFormat);
-    if (const auto configUpdateChannel = settings.value(QLatin1String(updateChannelC), defaultUpdateChannel()).toString();
+    if (const auto configUpdateChannel = settings.value(QLatin1String(updateChannelC), updateChannel).toString();
         validUpdateChannels().contains(configUpdateChannel)) {
         qCWarning(lcConfigFile()) << "Config file has a valid update channel:" << configUpdateChannel;
-        return configUpdateChannel;
+        updateChannel = configUpdateChannel;
     }
 
-    return defaultUpdateChannel();
+    return updateChannel;
 }
 
 void ConfigFile::setUpdateChannel(const QString &channel)