mapper: Don't return the input path in GetSubTree

In both GetSubTree and GetSubTreePaths, don't return
the input path as a result.  This matches the behavior
of the original mapper.

Change-Id: Ib4bab71a6001e9a18ab2565b0e2d708b034f8c44
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/src/main.cpp b/src/main.cpp
index 2643eed..9084d0d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -917,9 +917,8 @@
         });
 
     iface->register_method(
-        "GetSubTree",
-        [&interface_map](const std::string& req_path, int32_t depth,
-                         std::vector<std::string>& interfaces) {
+        "GetSubTree", [&interface_map](std::string& req_path, int32_t depth,
+                                       std::vector<std::string>& interfaces) {
             if (depth <= 0)
             {
                 depth = std::numeric_limits<int32_t>::max();
@@ -928,9 +927,20 @@
             std::sort(interfaces.begin(), interfaces.end());
             std::vector<interface_map_type::value_type> ret;
 
+            if (req_path.size() > 1 && req_path.back() == '/')
+            {
+                req_path.pop_back();
+            }
+
             for (auto& object_path : interface_map)
             {
                 auto& this_path = object_path.first;
+
+                if (this_path == req_path)
+                {
+                    continue;
+                }
+
                 if (boost::starts_with(this_path, req_path))
                 {
                     // count the number of slashes past the search term
@@ -961,7 +971,7 @@
 
     iface->register_method(
         "GetSubTreePaths",
-        [&interface_map](const std::string& req_path, int32_t depth,
+        [&interface_map](std::string& req_path, int32_t depth,
                          std::vector<std::string>& interfaces) {
             if (depth <= 0)
             {
@@ -970,9 +980,21 @@
             // Interfaces need to be sorted for intersect to function
             std::sort(interfaces.begin(), interfaces.end());
             std::vector<std::string> ret;
+
+            if (req_path.size() > 1 && req_path.back() == '/')
+            {
+                req_path.pop_back();
+            }
+
             for (auto& object_path : interface_map)
             {
                 auto& this_path = object_path.first;
+
+                if (this_path == req_path)
+                {
+                    continue;
+                }
+
                 if (boost::starts_with(this_path, req_path))
                 {
                     // count the number of slashes past the search term