From d9fb152b95855662d302295147a3987bc5d4d68f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 28 Dec 2023 21:12:32 +0100 Subject: [PATCH] lib/upnp/ContentDirectoryService: include some headers only with libpupnp --- src/db/plugins/upnp/ContentDirectoryService.cxx | 13 +++++++------ src/lib/upnp/Action.hxx | 7 +------ src/lib/upnp/ContentDirectoryService.cxx | 14 +++++++------- src/lib/upnp/UniqueIxml.hxx | 11 +++-------- src/lib/upnp/ixmlwrap.hxx | 9 ++------- 5 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/db/plugins/upnp/ContentDirectoryService.cxx b/src/db/plugins/upnp/ContentDirectoryService.cxx index d09d226dc..696e2a523 100644 --- a/src/db/plugins/upnp/ContentDirectoryService.cxx +++ b/src/db/plugins/upnp/ContentDirectoryService.cxx @@ -2,16 +2,17 @@ // Copyright The Music Player Daemon Project #include "lib/upnp/ContentDirectoryService.hxx" -#include "config.h" -#ifdef USING_PUPNP -# include "lib/upnp/ixmlwrap.hxx" -#endif -#include "lib/upnp/UniqueIxml.hxx" -#include "lib/upnp/Action.hxx" #include "lib/upnp/Error.hxx" #include "Directory.hxx" #include "util/NumberParser.hxx" #include "util/ScopeExit.hxx" +#include "config.h" + +#ifdef USING_PUPNP +#include "lib/upnp/ixmlwrap.hxx" +#include "lib/upnp/Action.hxx" +#include "lib/upnp/UniqueIxml.hxx" +#endif #include diff --git a/src/lib/upnp/Action.hxx b/src/lib/upnp/Action.hxx index c7bd2f5a3..14d710d06 100644 --- a/src/lib/upnp/Action.hxx +++ b/src/lib/upnp/Action.hxx @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef MPD_UPNP_ACTION_HXX -#define MPD_UPNP_ACTION_HXX +#pragma once #include @@ -20,7 +19,6 @@ CountNameValuePairs([[maybe_unused]] const char *name, [[maybe_unused]] const ch return 1 + CountNameValuePairs(args...); } -#ifdef USING_PUPNP /** * A wrapper for UpnpMakeAction() that counts the number of name/value * pairs and adds the nullptr sentinel. @@ -35,6 +33,3 @@ MakeActionHelper(const char *action_name, const char *service_type, args..., nullptr, nullptr); } -#endif - -#endif diff --git a/src/lib/upnp/ContentDirectoryService.cxx b/src/lib/upnp/ContentDirectoryService.cxx index 8a4278c62..3d3f157c3 100644 --- a/src/lib/upnp/ContentDirectoryService.cxx +++ b/src/lib/upnp/ContentDirectoryService.cxx @@ -1,19 +1,19 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#include "config.h" - #include "ContentDirectoryService.hxx" #include "Device.hxx" #include "Error.hxx" -#include "UniqueIxml.hxx" -#ifdef USING_PUPNP -# include "ixmlwrap.hxx" -#endif -#include "Action.hxx" #include "util/IterableSplitString.hxx" #include "util/UriRelative.hxx" #include "util/UriUtil.hxx" +#include "config.h" + +#ifdef USING_PUPNP +#include "ixmlwrap.hxx" +#include "Action.hxx" +#include "UniqueIxml.hxx" +#endif #include diff --git a/src/lib/upnp/UniqueIxml.hxx b/src/lib/upnp/UniqueIxml.hxx index 4efc32324..62e852c8a 100644 --- a/src/lib/upnp/UniqueIxml.hxx +++ b/src/lib/upnp/UniqueIxml.hxx @@ -1,13 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef MPD_UPNP_UNIQUE_XML_HXX -#define MPD_UPNP_UNIQUE_XML_HXX +#pragma once -#ifdef USING_PUPNP -# include +#include -# include +#include struct UpnpIxmlDeleter { void operator()(IXML_Document *doc) noexcept { @@ -21,6 +19,3 @@ struct UpnpIxmlDeleter { typedef std::unique_ptr UniqueIxmlDocument; typedef std::unique_ptr UniqueIxmlNodeList; - -#endif /* USING_PUPNP */ -#endif diff --git a/src/lib/upnp/ixmlwrap.hxx b/src/lib/upnp/ixmlwrap.hxx index b6499d826..077884552 100644 --- a/src/lib/upnp/ixmlwrap.hxx +++ b/src/lib/upnp/ixmlwrap.hxx @@ -1,11 +1,9 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright J.F.Dockes -#ifndef _IXMLWRAP_H_INCLUDED_ -#define _IXMLWRAP_H_INCLUDED_ +#pragma once -#ifdef USING_PUPNP -# include +#include namespace ixmlwrap { /** @@ -17,6 +15,3 @@ namespace ixmlwrap { const char *name) noexcept; } - -#endif /* USING_PUPNP */ -#endif /* _IXMLWRAP_H_INCLUDED_ */