]> git.sur5r.net Git - openldap/commitdiff
cleanup
authorKurt Zeilenga <kurt@openldap.org>
Tue, 31 Dec 2002 05:55:06 +0000 (05:55 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 31 Dec 2002 05:55:06 +0000 (05:55 +0000)
libraries/libldap/util-int.c

index 6a2d5bd3487481f09f20644d3196a16db3c50a58..e9e2e55e6b52c2c09cf9f366e02d2823e0a863d8 100644 (file)
 
 #include "ldap-int.h"
 
-#if !defined( LDAP_R_COMPILE )
+#ifndef LDAP_R_COMPILE
 # undef HAVE_REENTRANT_FUNCTIONS
 # undef HAVE_CTIME_R
 # undef HAVE_GETHOSTBYNAME_R
 # undef HAVE_GETHOSTBYADDR_R
 
 #else
-#      include <ldap_pvt_thread.h>
+# include <ldap_pvt_thread.h>
+  ldap_pvt_thread_mutex_t ldap_int_resolv_mutex;
 
 #if (defined( HAVE_CTIME_R ) || defined( HAVE_REENTRANT_FUNCTIONS)) \
        && defined( CTIME_R_NARGS )
-#      define USE_CTIME_R
-#else
+# define USE_CTIME_R
+# else
        static ldap_pvt_thread_mutex_t ldap_int_ctime_mutex;
-#endif
+# endif
 
-#if defined(HAVE_GETHOSTBYNAME_R) && \
+# if defined(HAVE_GETHOSTBYNAME_R) && \
        (GETHOSTBYNAME_R_NARGS < 5) || (6 < GETHOSTBYNAME_R_NARGS)
        /* Don't know how to handle this version, pretend it's not there */
 #      undef HAVE_GETHOSTBYNAME_R
-#endif
-#if defined(HAVE_GETHOSTBYADDR_R) && \
+# endif
+# if defined(HAVE_GETHOSTBYADDR_R) && \
        (GETHOSTBYADDR_R_NARGS < 7) || (8 < GETHOSTBYADDR_R_NARGS)
        /* Don't know how to handle this version, pretend it's not there */
 #      undef HAVE_GETHOSTBYADDR_R
-#endif
-
-       ldap_pvt_thread_mutex_t ldap_int_resolv_mutex;
+# endif
 #endif /* LDAP_R_COMPILE */
 
 char *ldap_pvt_ctime( const time_t *tp, char *buf )
@@ -120,9 +119,8 @@ int ldap_pvt_gethostbyname_a(
                        return r;
 
 #if (GETHOSTBYNAME_R_NARGS < 6)
-               r = ((*result=gethostbyname_r( name, resbuf, *buf,
-                                              buflen, herrno_ptr ))== NULL) ?
-                   -1 : 0;
+               *result=gethostbyname_r( name, resbuf, *buf, buflen, herrno_ptr );
+               r = (*result == NULL) ?  -1 : 0;
 #else
                r = gethostbyname_r( name, resbuf, *buf,
                        buflen, result, herrno_ptr );
@@ -201,10 +199,9 @@ int ldap_pvt_gethostbyaddr_a(
                if (safe_realloc( buf, buflen )==NULL)
                        return r;
 #if (GETHOSTBYADDR_R_NARGS < 8)
-               r = ((*result=gethostbyaddr_r( addr, len, type,
-                                              resbuf, *buf, buflen, 
-                                              herrno_ptr )) == NULL) ?
-                   -1 : 0;
+               *result=gethostbyaddr_r( addr, len, type,
+                       resbuf, *buf, buflen, herrno_ptr );
+               r = (*result == NULL) ? -1 : 0;
 #else
                r = gethostbyaddr_r( addr, len, type,
                        resbuf, *buf, buflen, 
@@ -284,7 +281,10 @@ void ldap_int_utils_init( void )
 # undef NEED_SAFE_REALLOC
 #define NEED_SAFE_REALLOC
 
-static char *cpy_aliases( char ***tgtio, char *buf, char **src )
+static char *cpy_aliases(
+       char ***tgtio,
+       char *buf,
+       char **src )
 {
        int len;
        char **tgt=*tgtio;
@@ -298,7 +298,11 @@ static char *cpy_aliases( char ***tgtio, char *buf, char **src )
        return buf;
 }
 
-static char *cpy_addresses( char ***tgtio, char *buf, char **src, int len )
+static char *cpy_addresses(
+       char ***tgtio,
+       char *buf,
+       char **src,
+       int len )
 {
        char **tgt=*tgtio;
        for( ; (*src) ; src++ ) {
@@ -310,7 +314,10 @@ static char *cpy_addresses( char ***tgtio, char *buf, char **src, int len )
        return buf;
 }
 
-static int copy_hostent( struct hostent *res, char **buf, struct hostent * src )
+static int copy_hostent(
+       struct hostent *res,
+       char **buf,
+       struct hostent * src )
 {
        char    **p;
        char    **tp;