From 71e9bb5d60e0eed1365dc461422c8ff6e11373f8 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 13 Jun 2018 13:13:36 +0200 Subject: [PATCH] Return early - minimize if indentation Summary: Use initializer list to create QSet Don't check what doesn't needs to be checked. the QBitArray knows how to deal with true / false directly, so remove the if's. the speedgain of the if's are probabely slower than just setting the values to true / false again anyway as we are not suffering from a possible branch-prediction, and plus, code is cleaner. No need to test for true / false to set true false Just set it directly Subscribers: konsole-devel Tags: #konsole Differential Revision: https://phabricator.kde.org/D13512 --- src/IncrementalSearchBar.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/IncrementalSearchBar.cpp b/src/IncrementalSearchBar.cpp index 2124680b..334a38d4 100644 --- a/src/IncrementalSearchBar.cpp +++ b/src/IncrementalSearchBar.cpp @@ -291,24 +291,8 @@ const QBitArray IncrementalSearchBar::optionsChecked() void IncrementalSearchBar::setOptions() { - if (KonsoleSettings::searchCaseSensitive()) { - _caseSensitive->setChecked(true); - } else { - _caseSensitive->setChecked(false); - } - if (KonsoleSettings::searchRegExpression()) { - _regExpression->setChecked(true); - } else { - _regExpression->setChecked(false); - } - if (KonsoleSettings::searchHighlightMatches()) { - _highlightMatches->setChecked(true); - } else { - _highlightMatches->setChecked(false); - } - if (KonsoleSettings::searchReverseSearch()) { - _reverseSearch->setChecked(true); - } else { - _reverseSearch->setChecked(false); - } + _caseSensitive->setChecked(KonsoleSettings::searchCaseSensitive()); + _regExpression->setChecked(KonsoleSettings::searchRegExpression()); + _highlightMatches->setChecked(KonsoleSettings::searchHighlightMatches()); + _reverseSearch->setChecked(KonsoleSettings::searchReverseSearch()); }