[PATCH:libSM 3/8] Move variable declarations to get rid of unnecessary scope brackets

Alan Coopersmith alan.coopersmith at oracle.com
Mon Dec 5 20:06:16 PST 2011


Gets rid of one of the multiple levels of bracketing that confusingly
shared the same indent level.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/sm_genid.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/sm_genid.c b/src/sm_genid.c
index c46a0c5..f0c196a 100644
--- a/src/sm_genid.c
+++ b/src/sm_genid.c
@@ -151,11 +151,6 @@ SmsGenerateClientID(SmsConn smsConn)
     char temp[256];
     char *id;
     static int sequence = 0;
-
-    if (gethostname (hostname, sizeof (hostname)))
-	return (NULL);
-
-    {
     char* inet_addr;
     char *ptr1;
     unsigned char decimal[4];
@@ -163,6 +158,12 @@ SmsGenerateClientID(SmsConn smsConn)
     struct in_addr *haddr = NULL;
 #  if defined(IPv6) && defined(AF_INET6)
     struct addrinfo *ai, *first_ai;
+#  endif
+
+    if (gethostname (hostname, sizeof (hostname)))
+	return (NULL);
+
+#  if defined(IPv6) && defined(AF_INET6)
     if (getaddrinfo(hostname,NULL,NULL,&ai) != 0)
 	return NULL;
 
@@ -234,7 +235,6 @@ SmsGenerateClientID(SmsConn smsConn)
     }
     freeaddrinfo(first_ai);
 #  endif
-    }
 
     sprintf (temp, "1%s%.13ld%.10ld%.4d", address, (long)time((Time_t*)0),
 	     (long)getpid(), sequence);
-- 
1.7.3.2



More information about the xorg-devel mailing list