[Devel] [PATCH] max_netmask(): switch fits better

Igor Podlesny openvz at poige.ru
Tue May 7 22:05:52 PDT 2013


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

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




More information about the Devel mailing list