From 3dea614e99d3776dbb074f1677b2a37c7310b076 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 31 Dec 2002 05:55:06 +0000 Subject: [PATCH] cleanup --- libraries/libldap/util-int.c | 49 ++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/libraries/libldap/util-int.c b/libraries/libldap/util-int.c index 6a2d5bd348..e9e2e55e6b 100644 --- a/libraries/libldap/util-int.c +++ b/libraries/libldap/util-int.c @@ -33,34 +33,33 @@ #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 +# include + 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; -- 2.39.5