From d5f7db59a8b87fc948c645a30e46466ae0a85127 Mon Sep 17 00:00:00 2001 From: Max Kellermann <max.kellermann@gmail.com> Date: Thu, 4 Jan 2024 13:03:31 +0100 Subject: [PATCH] lib/upnp/Util: pass std::string_view to path_getfather() --- src/lib/upnp/Util.cxx | 4 ++-- src/lib/upnp/Util.hxx | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/lib/upnp/Util.cxx b/src/lib/upnp/Util.cxx index fef1cd5c7..57800a845 100644 --- a/src/lib/upnp/Util.cxx +++ b/src/lib/upnp/Util.cxx @@ -27,9 +27,9 @@ path_catslash(std::string &s) noexcept } std::string -path_getfather(const std::string &s) noexcept +path_getfather(const std::string_view s) noexcept { - std::string father = s; + std::string father{s}; // ?? if (father.empty()) diff --git a/src/lib/upnp/Util.hxx b/src/lib/upnp/Util.hxx index 44423a39e..25e8ff9a4 100644 --- a/src/lib/upnp/Util.hxx +++ b/src/lib/upnp/Util.hxx @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef MPD_UPNP_UTIL_HXX -#define MPD_UPNP_UTIL_HXX +#pragma once #include <string> @@ -10,6 +9,4 @@ void trimstring(std::string &s, const char *ws = " \t\n") noexcept; std::string -path_getfather(const std::string &s) noexcept; - -#endif /* _UPNPP_H_X_INCLUDED_ */ +path_getfather(std::string_view s) noexcept;