[Devel] [PATCH 05/10] max_netmask(): switch fits better

Igor Podlesny openvz at poige.ru
Mon May 6 23:42:07 PDT 2013


---
 src/lib/util.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/lib/util.c b/src/lib/util.c
index 61ce5df..febb676 100644
--- a/src/lib/util.c
+++ b/src/lib/util.c
@@ -383,12 +383,11 @@ int get_netaddr(const char *ip_str, void *ip)
 
 static inline int max_netmask(int family)
 {
-	if (family == AF_INET)
-		return 32;
-	else if (family == AF_INET6)
-		return 128;
-	else
-		return -1;
+	switch (family) {
+	case AF_INET:	return 32;
+	case AF_INET6:	return 128;
+	default:	return -1;
+	}
 }
 
 /* Check and "canonicalize" an IP address with optional netmask
-- 
1.7.9.5




More information about the Devel mailing list