From 079de6fd4bd0423e20e472d7342f919eebce0517 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 19 Nov 2011 09:52:17 -0800 Subject: Use imdent to make multiple levels of nested #if easier to follow Signed-off-by: Alan Coopersmith Reviewed-by: James Cloos --- src/sm_genid.c | 72 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/sm_genid.c b/src/sm_genid.c index a138572..a8161ff 100644 --- a/src/sm_genid.c +++ b/src/sm_genid.c @@ -53,15 +53,15 @@ in this Software without prior written authorization from The Open Group. */ #ifdef WIN32 -#define _WILLWINSOCK_ +# define _WILLWINSOCK_ #endif #ifdef HAVE_CONFIG_H -#include +# include #endif #include #include "SMlibint.h" #ifdef XTHREADS -#include +# include #endif #include @@ -70,39 +70,39 @@ in this Software without prior written authorization from The Open Group. #ifndef WIN32 -#if defined(TCPCONN) || defined(STREAMSCONN) -#ifndef Lynx -#include -#else -#include -#endif -#include -#include -#define XOS_USE_NO_LOCKING -#define X_INCLUDE_NETDB_H -#include -#endif +# if defined(TCPCONN) || defined(STREAMSCONN) +# ifndef Lynx +# include +# else +# include +# endif +# include +# include +# define XOS_USE_NO_LOCKING +# define X_INCLUDE_NETDB_H +# include +# endif #else /* WIN32 */ -#include -#include -#define X_INCLUDE_NETDB_H -#define XOS_USE_MTSAFE_NETDBAPI -#include +# include +# include +# define X_INCLUDE_NETDB_H +# define XOS_USE_MTSAFE_NETDBAPI +# include #endif /* WIN32 */ #ifdef MNX_TCPCONN -#include +# include -#define TCPCONN +# define TCPCONN #endif #if defined(HAVE_UUID_CREATE) -#include +# include #elif defined(HAVE_LIBUUID) -#include +# include #endif @@ -144,7 +144,7 @@ SmsGenerateClientID(SmsConn smsConn) return id; #else -#if defined(TCPCONN) || defined(STREAMSCONN) +# if defined(TCPCONN) || defined(STREAMSCONN) static const char hex[] = "0123456789abcdef"; char hostname[256]; char address[64], *addr_ptr = address; @@ -161,7 +161,7 @@ SmsGenerateClientID(SmsConn smsConn) unsigned char decimal[4]; int i, len; struct in_addr *haddr = NULL; -#if defined(IPv6) && defined(AF_INET6) +# if defined(IPv6) && defined(AF_INET6) struct addrinfo *ai, *first_ai; if (getaddrinfo(hostname,NULL,NULL,&ai) != 0) return NULL; @@ -189,17 +189,17 @@ SmsGenerateClientID(SmsConn smsConn) } else { /* Fall through to IPv4 address handling */ haddr = &((struct sockaddr_in *)ai->ai_addr)->sin_addr; -#else -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS +# else +# ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; -#endif +# endif struct hostent *hostp; if ((hostp = _XGethostbyname (hostname,hparams)) != NULL) haddr = (struct in_addr *)(hostp->h_addr); else return NULL; -#endif +# endif inet_addr = inet_ntoa (*haddr); for (i = 0, ptr1 = inet_addr; i < 3; i++) @@ -207,9 +207,9 @@ SmsGenerateClientID(SmsConn smsConn) ptr2 = strchr (ptr1, '.'); len = ptr2 - ptr1; if (!ptr2 || len > 3) { -#if defined(IPv6) && defined(AF_INET6) +# if defined(IPv6) && defined(AF_INET6) freeaddrinfo(first_ai); -#endif +# endif return (NULL); } strncpy (temp, ptr1, len); @@ -229,10 +229,10 @@ SmsGenerateClientID(SmsConn smsConn) *addr_ptr++ = '\0'; -#if defined(IPv6) && defined(AF_INET6) +# if defined(IPv6) && defined(AF_INET6) } freeaddrinfo(first_ai); -#endif +# endif } sprintf (temp, "1%s%.13ld%.10ld%.4d", address, (long)time((Time_t*)0), @@ -245,8 +245,8 @@ SmsGenerateClientID(SmsConn smsConn) strcpy (id, temp); return (id); -#else +# else return (NULL); -#endif +# endif #endif } -- cgit v1.2.1