From 09d9e5e19b4ddcd1962f513628a86fe0bb8254a0 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Thu, 21 May 2009 21:10:25 +0000 Subject: [PATCH] Minor code cleanups --- code/qcommon/net_ip.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c index 8ac39a57..848e8c5c 100644 --- a/code/qcommon/net_ip.c +++ b/code/qcommon/net_ip.c @@ -419,11 +419,10 @@ const char *NET_AdrToString (netadr_t a) { static char s[NET_ADDRSTRMAXLEN]; - if (a.type == NA_LOOPBACK) { + if (a.type == NA_LOOPBACK) Com_sprintf (s, sizeof(s), "loopback"); - } else if (a.type == NA_BOT) { + else if (a.type == NA_BOT) Com_sprintf (s, sizeof(s), "bot"); - } else if (a.type == NA_IP || a.type == NA_IP6) { struct sockaddr_storage sadr; @@ -440,18 +439,14 @@ const char *NET_AdrToStringwPort (netadr_t a) { static char s[NET_ADDRSTRMAXLEN]; - if (a.type == NA_LOOPBACK) { + if (a.type == NA_LOOPBACK) Com_sprintf (s, sizeof(s), "loopback"); - } else if (a.type == NA_BOT) { + else if (a.type == NA_BOT) Com_sprintf (s, sizeof(s), "bot"); - } - else if (a.type == NA_IP || a.type == NA_IP6) - { - if(a.type == NA_IP) - Com_sprintf(s, sizeof(s), "%s:%hu", NET_AdrToString(a), ntohs(a.port)); - else if(a.type == NA_IP6) - Com_sprintf(s, sizeof(s), "[%s]:%hu", NET_AdrToString(a), ntohs(a.port)); - } + else if(a.type == NA_IP) + Com_sprintf(s, sizeof(s), "%s:%hu", NET_AdrToString(a), ntohs(a.port)); + else if(a.type == NA_IP6) + Com_sprintf(s, sizeof(s), "[%s]:%hu", NET_AdrToString(a), ntohs(a.port)); return s; }