Use reference type in vector iteration 91/282091/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Mon, 26 Sep 2022 11:13:22 +0000 (20:13 +0900)
committerTizen AI <ai.tzn.sec@samsung.com>
Tue, 27 Sep 2022 04:12:51 +0000 (13:12 +0900)
Change-Id: Ic35c58fbaeffc37d3c9a6d19751b119270a15175
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
src/mmimgr/iu/CommandFinder.cpp

index 986c05f..f63ef34 100644 (file)
@@ -84,7 +84,7 @@ ClickableItem* CommandFinder::findCommandByIndex()
                return nullptr;
        }
 
-       for (auto command : __commands) {
+       for (auto& command : __commands) {
                if (command->index == __index) {
                        _I("[CommandFinder] result command(%s)", command->label.c_str());
                        return command.get();
@@ -98,7 +98,7 @@ ClickableItem* CommandFinder::findCommandByText()
 {
        _I("[CommandFinder] Find command by text");
 
-       for (auto command : __commands) {
+       for (auto& command : __commands) {
                string label = StringUtil::makeLowerCase(command->label);
 
                bool isValid = true;
@@ -125,7 +125,7 @@ ClickableItem* CommandFinder::findCommandByWord()
        ClickableItem* result = nullptr;
 
        _I("[CommandFinder] Minimum matching word number (%d)", maxNumber);
-       for (auto command : __commands) {
+       for (auto& command : __commands) {
                string label = StringUtil::makeLowerCase(command->label);
 
                int numOfWord = 0;
@@ -155,7 +155,7 @@ ClickableItem* CommandFinder::findCommandByChar()
        ClickableItem* result = nullptr;
        int resultScore = numeric_limits<int>::max();
 
-       for (auto command : __commands) {
+       for (auto& command : __commands) {
                string label = StringUtil::makeLowerCase(command->label);
                vector<string> splitLabel = StringUtil::splitText(label, ' ');
                _D("[CommandFinder] Command(%s), candidate(%s)", __loweredText.c_str(), label.c_str());