util: isValidIP should be noexcept
Change-Id: Ia61742dc253a0a1cfce7e9659c1bb75a2f979cc7
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/util.cpp b/src/util.cpp
index 8a39bb1..915f2b4 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -204,10 +204,10 @@
throw std::runtime_error("Invalid addr type");
}
-bool isValidIP(int addressFamily, stdplus::const_zstring address)
+bool isValidIP(int family, stdplus::const_zstring address) noexcept
{
unsigned char buf[sizeof(struct in6_addr)];
- return inet_pton(addressFamily, address.c_str(), buf) > 0;
+ return inet_pton(family, address.c_str(), buf) > 0;
}
bool isValidPrefix(int family, uint8_t prefix)
diff --git a/src/util.hpp b/src/util.hpp
index 023d375..84c6574 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -107,11 +107,11 @@
std::string toString(const struct in6_addr& addr);
/* @brief checks that the given ip address valid or not.
- * @param[in] addressFamily - IP address family(AF_INET/AF_INET6).
+ * @param[in] family - IP address family(AF_INET/AF_INET6).
* @param[in] address - IP address.
* @returns true if it is valid otherwise false.
*/
-bool isValidIP(int addressFamily, stdplus::const_zstring address);
+bool isValidIP(int family, stdplus::const_zstring address) noexcept;
/* @brief checks that the given prefix is valid or not.
* @param[in] family - IP address family(AF_INET/AF_INET6).