diff options
author | Max Kellermann <max@musicpd.org> | 2019-01-21 21:20:43 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-01-21 21:20:43 +0100 |
commit | 02c68c5cdb7611dbb821174e589c7df9660ea240 (patch) | |
tree | 857f46dcb04a93a5bf4811712066606a628e0846 /src/net | |
parent | b02fee7309c0e213f07f560ac292835c51b44a4e (diff) |
net/HostParser: add `noexcept`
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/HostParser.cxx | 12 | ||||
-rw-r--r-- | src/net/HostParser.hxx | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/net/HostParser.cxx b/src/net/HostParser.cxx index 3dd6bbec6..1f639aded 100644 --- a/src/net/HostParser.cxx +++ b/src/net/HostParser.cxx @@ -36,7 +36,7 @@ #include <string.h> static inline bool -IsValidHostnameChar(char ch) +IsValidHostnameChar(char ch) noexcept { return IsAlphaNumericASCII(ch) || ch == '-' || ch == '.' || @@ -44,14 +44,14 @@ IsValidHostnameChar(char ch) } static inline bool -IsValidScopeChar(char ch) +IsValidScopeChar(char ch) noexcept { return IsAlphaNumericASCII(ch) || ch == '-' || ch == '_'; } static const char * -FindScopeEnd(const char *p) +FindScopeEnd(const char *p) noexcept { if (*p == '%' && IsValidScopeChar(p[1])) { p += 2; @@ -63,7 +63,7 @@ FindScopeEnd(const char *p) } static inline bool -IsValidIPv6Char(char ch) +IsValidIPv6Char(char ch) noexcept { return IsDigitASCII(ch) || (ch >= 'a' && ch <= 'f') || @@ -72,7 +72,7 @@ IsValidIPv6Char(char ch) } static const char * -FindIPv6End(const char *p) +FindIPv6End(const char *p) noexcept { while (IsValidIPv6Char(*p)) ++p; @@ -84,7 +84,7 @@ FindIPv6End(const char *p) } ExtractHostResult -ExtractHost(const char *src) +ExtractHost(const char *src) noexcept { ExtractHostResult result{nullptr, src}; const char *hostname; diff --git a/src/net/HostParser.hxx b/src/net/HostParser.hxx index a31dcb2f7..594bd24f3 100644 --- a/src/net/HostParser.hxx +++ b/src/net/HostParser.hxx @@ -57,7 +57,7 @@ struct ExtractHostResult { */ const char *end; - constexpr bool HasFailed() const { + constexpr bool HasFailed() const noexcept { return host == nullptr; } }; @@ -71,6 +71,6 @@ struct ExtractHostResult { */ gcc_pure ExtractHostResult -ExtractHost(const char *src); +ExtractHost(const char *src) noexcept; #endif |