From 5a43df82b89f5f396d845ced49b9f3f65dee52ab Mon Sep 17 00:00:00 2001
From: Jardel Weyrich <jweyrich@users.sourceforge.net>
Date: Mon, 28 Dec 2009 16:03:47 -0500
Subject: [PATCH] Improve readability of evutil_unparse_protoname()

---
 evutil.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/evutil.c b/evutil.c
index 2e58a310..800e40b2 100644
--- a/evutil.c
+++ b/evutil.c
@@ -535,24 +535,27 @@ evutil_parse_servname(const char *servname, const char *protocol,
 static const char *
 evutil_unparse_protoname(int proto)
 {
-	if (proto == 0)
+	switch (proto) {
+	case 0:
 		return NULL;
-	else if (proto == IPPROTO_TCP)
+	case IPPROTO_TCP:
 		return "tcp";
-	else if (proto == IPPROTO_UDP)
+	case IPPROTO_UDP:
 		return "udp";
 #ifdef IPPROTO_SCTP
-	else if (proto == IPPROTO_SCTP)
+	case IPPROTO_SCTP:
 		return "sctp";
 #endif
+	default:
 #ifdef _EVENT_HAVE_GETPROTOBYNUMBER
-	{
-		struct protoent *ent = getprotobynumber(proto);
-		if (ent)
-			return ent->p_name;
-	}
+		{
+			struct protoent *ent = getprotobynumber(proto);
+			if (ent)
+				return ent->p_name;
+		}
 #endif
-	return NULL;
+		return NULL;
+	}
 }
 
 static void
-- 
2.40.0