match: more string_view improvements

  - It has been suggested that `string_view` is better than `const
    string_view&`[1].  Switch all calls to that type.

  - In some cases the optimizations using string_view allowed
    non-zstrings to be passed to sdbus calls without compiler warning.
    Revert back to sacrificing the slight performance of constructing
    the string for safety.

[1]: https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I21a542fc9264b0f998e1c234064b6e6414327b82
diff --git a/include/sdbusplus/bus/match.hpp b/include/sdbusplus/bus/match.hpp
index 57bb3c9..82414c4 100644
--- a/include/sdbusplus/bus/match.hpp
+++ b/include/sdbusplus/bus/match.hpp
@@ -49,9 +49,9 @@
 
         _slot = std::move(slot);
     }
-    match(sdbusplus::bus_t& bus, const std::string_view& _match,
+    match(sdbusplus::bus_t& bus, const std::string& _match,
           sd_bus_message_handler_t handler, void* context = nullptr) :
-        match(bus, _match.data(), handler, context)
+        match(bus, _match.c_str(), handler, context)
     {}
 
     using callback_t = std::function<void(sdbusplus::message_t&)>;
@@ -71,7 +71,7 @@
 
         _slot = std::move(slot);
     }
-    match(sdbusplus::bus_t& bus, const std::string_view& _match,
+    match(sdbusplus::bus_t& bus, const std::string& _match,
           callback_t callback) :
         match(bus, _match.data(), callback)
     {}
@@ -123,42 +123,42 @@
 
 } // namespace type
 
-inline constexpr auto sender(const std::string_view& s) noexcept
+inline constexpr auto sender(std::string_view s) noexcept
 {
     return "sender='"s.append(s).append("',");
 }
-inline constexpr auto interface(const std::string_view& s) noexcept
+inline constexpr auto interface(std::string_view s) noexcept
 {
     return "interface='"s.append(s).append("',");
 }
-inline constexpr auto member(const std::string_view& s) noexcept
+inline constexpr auto member(std::string_view s) noexcept
 {
     return "member='"s.append(s).append("',");
 }
-inline constexpr auto path(const std::string_view& s) noexcept
+inline constexpr auto path(std::string_view s) noexcept
 {
     return "path='"s.append(s).append("',");
 }
-inline constexpr auto path_namespace(const std::string_view& s) noexcept
+inline constexpr auto path_namespace(std::string_view s) noexcept
 {
     return "path_namespace='"s.append(s).append("',");
 }
-inline constexpr auto destination(const std::string_view& s) noexcept
+inline constexpr auto destination(std::string_view s) noexcept
 {
     return "destination='"s.append(s).append("',");
 }
-inline auto argN(size_t n, const std::string_view& s) noexcept
+inline auto argN(size_t n, std::string_view s) noexcept
 {
     return "arg"s.append(std::to_string(n)).append("='").append(s).append("',");
 }
-inline auto argNpath(size_t n, const std::string_view& s) noexcept
+inline auto argNpath(size_t n, std::string_view s) noexcept
 {
     return "arg"s.append(std::to_string(n))
         .append("path='"s)
         .append(s)
         .append("',");
 }
-inline constexpr auto arg0namespace(const std::string_view& s) noexcept
+inline constexpr auto arg0namespace(std::string_view s) noexcept
 {
     return "arg0namespace='"s.append(s).append("',");
 }
@@ -188,19 +188,17 @@
            "member='InterfacesRemoved',";
 }
 
-inline constexpr std::string interfacesAdded(const std::string_view& p) noexcept
+inline constexpr std::string interfacesAdded(std::string_view p) noexcept
 {
     return std::string(interfacesAdded()).append(path(p));
 }
 
-inline constexpr std::string
-    interfacesRemoved(const std::string_view& p) noexcept
+inline constexpr std::string interfacesRemoved(std::string_view p) noexcept
 {
     return std::string(interfacesRemoved()).append(path(p));
 }
 
-inline auto propertiesChanged(const std::string_view& p,
-                              const std::string_view& i) noexcept
+inline auto propertiesChanged(std::string_view p, std::string_view i) noexcept
 {
     return std::string(type::signal())
         .append(path(p))
@@ -209,8 +207,8 @@
         .append(argN(0, i));
 }
 
-inline auto propertiesChangedNamespace(const std::string_view& p,
-                                       const std::string_view& i) noexcept
+inline auto propertiesChangedNamespace(std::string_view p,
+                                       std::string_view i) noexcept
 {
     return std::string(type::signal())
         .append(path_namespace(p))
@@ -225,7 +223,7 @@
  *
  * @return NameOwnerChanged match string for a service name
  */
-inline auto nameOwnerChanged(const std::string_view& s) noexcept
+inline auto nameOwnerChanged(std::string_view s) noexcept
 {
     return std::string(nameOwnerChanged()).append(argN(0, s));
 }