summaryrefslogtreecommitdiff
path: root/src/lib/upnp
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-05-08 14:44:49 +0200
committerMax Kellermann <max@musicpd.org>2017-05-08 14:44:49 +0200
commit71f0ed8b7499011b53f90998ebfbd3250fd80948 (patch)
treee9c2f66fbef231858f46d878864199d46e6ce21c /src/lib/upnp
parentac2e4e593d407e41db49fdb9ae2da6bc1557f618 (diff)
*: add "noexcept" to many, many function prototypes
This eliminates some overhead, because the compiler doesn't need to consider these functions throwing.
Diffstat (limited to 'src/lib/upnp')
-rw-r--r--src/lib/upnp/Discovery.cxx4
-rw-r--r--src/lib/upnp/Util.cxx12
-rw-r--r--src/lib/upnp/Util.hxx8
3 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx
index 024658683..121c01c57 100644
--- a/src/lib/upnp/Discovery.cxx
+++ b/src/lib/upnp/Discovery.cxx
@@ -36,7 +36,7 @@ static constexpr char ContentDirectorySType[] = "urn:schemas-upnp-org:service:Co
// version 1
gcc_pure
static bool
-isCDService(const char *st)
+isCDService(const char *st) noexcept
{
constexpr size_t sz = sizeof(ContentDirectorySType) - 3;
return memcmp(ContentDirectorySType, st, sz) == 0;
@@ -47,7 +47,7 @@ static constexpr char MediaServerDType[] = "urn:schemas-upnp-org:device:MediaSer
gcc_pure
static bool
-isMSDevice(const char *st)
+isMSDevice(const char *st) noexcept
{
constexpr size_t sz = sizeof(MediaServerDType) - 3;
return memcmp(MediaServerDType, st, sz) == 0;
diff --git a/src/lib/upnp/Util.cxx b/src/lib/upnp/Util.cxx
index 61c11719d..b6cd4189e 100644
--- a/src/lib/upnp/Util.cxx
+++ b/src/lib/upnp/Util.cxx
@@ -23,7 +23,7 @@
/** Get rid of white space at both ends */
void
-trimstring(std::string &s, const char *ws)
+trimstring(std::string &s, const char *ws) noexcept
{
auto pos = s.find_first_not_of(ws);
if (pos == std::string::npos) {
@@ -38,14 +38,14 @@ trimstring(std::string &s, const char *ws)
}
static void
-path_catslash(std::string &s)
+path_catslash(std::string &s) noexcept
{
if (s.empty() || s.back() != '/')
s += '/';
}
std::string
-path_getfather(const std::string &s)
+path_getfather(const std::string &s) noexcept
{
std::string father = s;
@@ -71,7 +71,7 @@ path_getfather(const std::string &s)
std::list<std::string>
stringToTokens(const std::string &str,
- const char delim)
+ const char delim) noexcept
{
std::list<std::string> tokens;
@@ -105,7 +105,7 @@ stringToTokens(const std::string &str,
template <class T>
bool
-csvToStrings(const char *s, T &tokens)
+csvToStrings(const char *s, T &tokens) noexcept
{
assert(tokens.empty());
@@ -132,4 +132,4 @@ csvToStrings(const char *s, T &tokens)
}
}
-template bool csvToStrings<std::list<std::string>>(const char *, std::list<std::string> &);
+template bool csvToStrings<std::list<std::string>>(const char *, std::list<std::string> &) noexcept;
diff --git a/src/lib/upnp/Util.hxx b/src/lib/upnp/Util.hxx
index b935611ec..5ff2710a6 100644
--- a/src/lib/upnp/Util.hxx
+++ b/src/lib/upnp/Util.hxx
@@ -26,17 +26,17 @@
#include <list>
void
-trimstring(std::string &s, const char *ws = " \t\n");
+trimstring(std::string &s, const char *ws = " \t\n") noexcept;
std::string
-path_getfather(const std::string &s);
+path_getfather(const std::string &s) noexcept;
gcc_pure
std::list<std::string>
-stringToTokens(const std::string &str, char delim);
+stringToTokens(const std::string &str, char delim) noexcept;
template <class T>
bool
-csvToStrings(const char *s, T &tokens);
+csvToStrings(const char *s, T &tokens) noexcept;
#endif /* _UPNPP_H_X_INCLUDED_ */