Combine owned strings

There are two lists in object_server for storing strings that need their
lifetime extended for both methods and signal names.  Neither list is
used independently, and exists entirely just to store strings to give
the vtables something to point to, so there's no sense in keeping two
lists.

As some point, these could arguably become static sets, so that strings
memory footprints are deduplicated between interfaces in the same
daemon, but that is a more invasive change.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie676a4ffb524387abf12a0ed20f50d109c85bc58
diff --git a/include/sdbusplus/asio/object_server.hpp b/include/sdbusplus/asio/object_server.hpp
index 45f3e4f..a8fcc53 100644
--- a/include/sdbusplus/asio/object_server.hpp
+++ b/include/sdbusplus/asio/object_server.hpp
@@ -541,13 +541,8 @@
         static constexpr auto signature = utility::tuple_to_array(
             message::types::type_id<SignalSignature...>());
 
-        auto [itr, inserted] = signalNames_.insert(name);
-        if (!inserted)
-        {
-            return false;
-        }
-
-        vtable_.emplace_back(vtable::signal(itr->c_str(), signature.data()));
+        const std::string& itr = methodOrSignalNames_.emplace_back(name);
+        vtable_.emplace_back(vtable::signal(itr.c_str(), signature.data()));
         return true;
     }
 
@@ -570,7 +565,7 @@
         static const auto resultType =
             utility::tuple_to_array(message::types::type_id<ResultType>());
 
-        auto nameItr = methodNames_.emplace(methodNames_.end(), name);
+        const std::string& nameItr = methodOrSignalNames_.emplace_back(name);
 
         if constexpr (callbackYields<CallbackType>)
         {
@@ -585,7 +580,7 @@
                     std::move(handler));
         }
 
-        vtable_.emplace_back(vtable::method(nameItr->c_str(), argType.data(),
+        vtable_.emplace_back(vtable::method(nameItr.c_str(), argType.data(),
                                             resultType.data(), method_handler));
         return true;
     }
@@ -773,8 +768,7 @@
     std::string path_;
     std::string name_;
     std::list<std::string> propertyNames_;
-    std::list<std::string> methodNames_;
-    std::set<std::string> signalNames_;
+    std::list<std::string> methodOrSignalNames_;
     std::unordered_map<std::string, std::unique_ptr<callback>> callbacksGet_;
     std::unordered_map<std::string, std::unique_ptr<callback_set>>
         callbacksSet_;