query: remove unused branch of $select

The array branch is never used since we don't yet support $select in
object arrays. This commit can be merged before any other optimization:
two pointers, Trie, etc.

Surprisingly, this commit doesn't save any binary size. The binary
doesn't change at all.

Tested:
1. unit test
2. tested on real hardware, $select is working as expected.
URL:
/redfish/v1/Systems/system?$select=Status
{
    "@odata.id": "/redfish/v1/Systems/system",
    "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem",
    "Status": {
        "Health": "OK",
        "HealthRollup": "OK",
        "State": "Enabled"
    }
}

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ia00f1e2b8d9a5787f8c6d819d2f817808364abd5
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index 868f5e7..57dee3c 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -723,10 +723,11 @@
 // |root| JSON in the async response, this function erases leaves whose keys are
 // not in the |shouldSelect| set.
 // |shouldSelect| contains all the properties that needs to be selected.
-inline void recursiveSelect(
-    nlohmann::json& currRoot, const nlohmann::json::json_pointer& currRootPtr,
-    const std::unordered_set<std::string>& intermediatePaths,
-    const std::unordered_set<std::string>& properties, nlohmann::json& root)
+inline void
+    recursiveSelect(nlohmann::json& currRoot,
+                    const nlohmann::json::json_pointer& currRootPtr,
+                    const std::unordered_set<std::string>& intermediatePaths,
+                    const std::unordered_set<std::string>& properties)
 {
     nlohmann::json::object_t* object =
         currRoot.get_ptr<nlohmann::json::object_t*>();
@@ -747,30 +748,14 @@
             if (intermediatePaths.contains(childPtr))
             {
                 BMCWEB_LOG_DEBUG << "Recursively select: " << childPtr;
-                recursiveSelect(*it, childPtr, intermediatePaths, properties,
-                                root);
+                recursiveSelect(*it, childPtr, intermediatePaths, properties);
                 it = nextIt;
                 continue;
             }
             BMCWEB_LOG_DEBUG << childPtr << " is getting removed!";
             it = currRoot.erase(it);
         }
-        return;
     }
-    nlohmann::json::array_t* array =
-        currRoot.get_ptr<nlohmann::json::array_t*>();
-    if (array != nullptr)
-    {
-        BMCWEB_LOG_DEBUG << "Current JSON is an array: " << currRootPtr;
-        if (properties.contains(currRootPtr))
-        {
-            return;
-        }
-        root[currRootPtr.parent_pointer()].erase(currRootPtr.back());
-        BMCWEB_LOG_DEBUG << currRootPtr << " is getting removed!";
-        return;
-    }
-    BMCWEB_LOG_DEBUG << "Current JSON is a property value: " << currRootPtr;
 }
 
 inline std::unordered_set<std::string>
@@ -804,7 +789,7 @@
     std::unordered_set<std::string> intermediatePaths =
         getIntermediatePaths(properties);
     recursiveSelect(root, nlohmann::json::json_pointer(""), intermediatePaths,
-                    properties, root);
+                    properties);
 }
 
 // The current implementation of $select still has the following TODOs due to