From 4c9942534cad9f7e5bf42e99eefa6291de100463 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 4 Jan 2024 13:02:06 +0100 Subject: [PATCH] lib/upnp/Device: pass url as std::string_view to Parse() --- src/lib/upnp/Device.cxx | 2 +- src/lib/upnp/Device.hxx | 7 ++----- src/lib/upnp/Discovery.hxx | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/lib/upnp/Device.cxx b/src/lib/upnp/Device.cxx index b45e50762..3221642fd 100644 --- a/src/lib/upnp/Device.cxx +++ b/src/lib/upnp/Device.cxx @@ -79,7 +79,7 @@ protected: }; void -UPnPDevice::Parse(const std::string &url, const char *description) +UPnPDevice::Parse(const std::string_view url, const char *description) { { UPnPDeviceParser mparser(*this); diff --git a/src/lib/upnp/Device.hxx b/src/lib/upnp/Device.hxx index 2488a41af..d0f739701 100644 --- a/src/lib/upnp/Device.hxx +++ b/src/lib/upnp/Device.hxx @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef _UPNPDEV_HXX_INCLUDED_ -#define _UPNPDEV_HXX_INCLUDED_ +#pragma once #include #include @@ -57,7 +56,5 @@ public: * @param url where the description came from * @param description the xml device description */ - void Parse(const std::string &url, const char *description); + void Parse(std::string_view url, const char *description); }; - -#endif /* _UPNPDEV_HXX_INCLUDED_ */ diff --git a/src/lib/upnp/Discovery.hxx b/src/lib/upnp/Discovery.hxx index 2b106f51c..9fcaf4b2d 100644 --- a/src/lib/upnp/Discovery.hxx +++ b/src/lib/upnp/Discovery.hxx @@ -55,7 +55,7 @@ class UPnPDeviceDirectory final : UpnpCallback { :id(std::move(_id)), expires(last + exp + std::chrono::seconds(20)) {} - void Parse(const std::string &url, const char *description) { + void Parse(std::string_view url, const char *description) { device.Parse(url, description); } };