From cbc11c92331833b426a1f78ff4e49b873ac568dd Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 14 Feb 2006 23:18:12 +0000 Subject: [PATCH] unifdef -DLDAP_NULL_IS_NULL --- include/lber.h | 4 ---- libraries/liblber/decode.c | 8 -------- libraries/libldap/error.c | 14 -------------- libraries/libldap/extended.c | 9 --------- libraries/libldap/result.c | 23 ----------------------- libraries/libldap/sasl.c | 10 ---------- servers/slapd/back-ldap/bind.c | 10 ---------- servers/slapd/back-ldap/extended.c | 20 -------------------- servers/slapd/back-ldap/search.c | 12 ------------ servers/slapd/back-meta/search.c | 15 --------------- 10 files changed, 125 deletions(-) diff --git a/include/lber.h b/include/lber.h index 460e0c2603..3017d56181 100644 --- a/include/lber.h +++ b/include/lber.h @@ -622,10 +622,6 @@ LBER_F( int * ) ber_errno_addr LDAP_P((void)); #define LBER_ERROR_PARAM 0x1 #define LBER_ERROR_MEMORY 0x2 -#ifdef LDAP_DEVEL -#define LDAP_NULL_IS_NULL -#endif - LDAP_END_DECL #endif /* _LBER_H */ diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c index a874c06765..3ff84d34b8 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -479,7 +479,6 @@ ber_get_stringbv( BerElement *ber, struct berval *bv, int alloc ) return tag; } -#ifdef LDAP_NULL_IS_NULL ber_tag_t ber_get_stringbv_null( BerElement *ber, struct berval *bv, int alloc ) { @@ -528,7 +527,6 @@ ber_get_stringbv_null( BerElement *ber, struct berval *bv, int alloc ) return tag; } -#endif /* LDAP_NULL_IS_NULL */ ber_tag_t ber_get_stringa( BerElement *ber, char **buf ) @@ -544,7 +542,6 @@ ber_get_stringa( BerElement *ber, char **buf ) return tag; } -#ifdef LDAP_NULL_IS_NULL ber_tag_t ber_get_stringa_null( BerElement *ber, char **buf ) { @@ -558,7 +555,6 @@ ber_get_stringa_null( BerElement *ber, char **buf ) return tag; } -#endif /* LDAP_NULL_IS_NULL */ ber_tag_t ber_get_stringal( BerElement *ber, struct berval **bv ) @@ -759,13 +755,11 @@ ber_scanf ( BerElement *ber, rc = ber_get_stringa( ber, ss ); break; -#ifdef LDAP_NULL_IS_NULL case 'A': /* octet string - allocate storage as needed, * but return NULL if len == 0 */ ss = va_arg( ap, char ** ); rc = ber_get_stringa_null( ber, ss ); break; -#endif /* LDAP_NULL_IS_NULL */ case 'b': /* boolean */ i = va_arg( ap, ber_int_t * ); @@ -920,9 +914,7 @@ ber_scanf ( BerElement *ber, } break; case 'a': /* octet string - allocate storage as needed */ -#ifdef LDAP_NULL_IS_NULL case 'A': -#endif /* LDAP_NULL_IS_NULL */ ss = va_arg( ap, char ** ); if ( *ss ) { LBER_FREE( *ss ); diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c index b102d4ab77..825c4ec0d0 100644 --- a/libraries/libldap/error.c +++ b/libraries/libldap/error.c @@ -313,24 +313,14 @@ ldap_parse_result( ber = ber_dup( lm->lm_ber ); if ( ld->ld_version < LDAP_VERSION2 ) { -#ifdef LDAP_NULL_IS_NULL tag = ber_scanf( ber, "{iA}", &ld->ld_errno, &ld->ld_error ); -#else /* ! LDAP_NULL_IS_NULL */ - tag = ber_scanf( ber, "{ia}", - &ld->ld_errno, &ld->ld_error ); -#endif /* ! LDAP_NULL_IS_NULL */ } else { ber_len_t len; -#ifdef LDAP_NULL_IS_NULL tag = ber_scanf( ber, "{iAA" /*}*/, &ld->ld_errno, &ld->ld_matched, &ld->ld_error ); -#else /* ! LDAP_NULL_IS_NULL */ - tag = ber_scanf( ber, "{iaa" /*}*/, - &ld->ld_errno, &ld->ld_matched, &ld->ld_error ); -#endif /* ! LDAP_NULL_IS_NULL */ if( tag != LBER_ERROR ) { /* peek for referrals */ @@ -391,17 +381,13 @@ ldap_parse_result( } if ( errcode == LDAP_SUCCESS ) { if( matcheddnp != NULL ) { -#ifdef LDAP_NULL_IS_NULL if ( ld->ld_matched ) -#endif /* LDAP_NULL_IS_NULL */ { *matcheddnp = LDAP_STRDUP( ld->ld_matched ); } } if( errmsgp != NULL ) { -#ifdef LDAP_NULL_IS_NULL if ( ld->ld_error ) -#endif /* LDAP_NULL_IS_NULL */ { *errmsgp = LDAP_STRDUP( ld->ld_error ); } diff --git a/libraries/libldap/extended.c b/libraries/libldap/extended.c index 345f48a297..6afc1d7f63 100644 --- a/libraries/libldap/extended.c +++ b/libraries/libldap/extended.c @@ -210,13 +210,8 @@ ldap_parse_extended_result ( return ld->ld_errno; } -#ifdef LDAP_NULL_IS_NULL rc = ber_scanf( ber, "{eAA" /*}*/, &errcode, &ld->ld_matched, &ld->ld_error ); -#else /* ! LDAP_NULL_IS_NULL */ - rc = ber_scanf( ber, "{eaa" /*}*/, &errcode, - &ld->ld_matched, &ld->ld_error ); -#endif /* ! LDAP_NULL_IS_NULL */ if( rc == LBER_ERROR ) { ld->ld_errno = LDAP_DECODING_ERROR; @@ -248,9 +243,7 @@ ldap_parse_extended_result ( return ld->ld_errno; } -#ifdef LDAP_NULL_IS_NULL assert( resoid[ 0 ] != '\0' ); -#endif /* LDAP_NULL_IS_NULL */ tag = ber_peek_tag( ber, &len ); } @@ -359,9 +352,7 @@ ldap_parse_intermediate ( return ld->ld_errno; } -#ifdef LDAP_NULL_IS_NULL assert( resoid[ 0 ] != '\0' ); -#endif /* LDAP_NULL_IS_NULL */ tag = ber_peek_tag( ber, &len ); } diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index ad3263d392..a3fec31dcb 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -568,23 +568,11 @@ nextresp2: ber_len_t len; char *lr_res_error = NULL; -#ifdef LDAP_NULL_IS_NULL if ( ber_scanf( &tmpber, "{eAA",/*}*/ &lderr, &lr->lr_res_matched, &lr_res_error ) != LBER_ERROR ) -#else /* ! LDAP_NULL_IS_NULL */ - if ( ber_scanf( &tmpber, "{eaa",/*}*/ &lderr, - &lr->lr_res_matched, &lr_res_error ) - != LBER_ERROR ) -#endif /* ! LDAP_NULL_IS_NULL */ { if ( lr_res_error != NULL ) { -#ifndef LDAP_NULL_IS_NULL - if ( lr_res_error[ 0 ] == '\0' ) { - LDAP_FREE( lr_res_error ); - lr_res_error = NULL; - } else -#endif /* ! LDAP_NULL_IS_NULL */ { if ( lr->lr_res_error != NULL ) { (void)ldap_append_referral( ld, &lr->lr_res_error, lr_res_error ); @@ -667,22 +655,11 @@ nextresp2: */ if ( tag == LDAP_RES_SEARCH_RESULT ) refer_cnt = 0; -#ifdef LDAP_NULL_IS_NULL } else if ( ber_scanf( &tmpber, "{eAA}", &lderr, &lr->lr_res_matched, &lr_res_error ) != LBER_ERROR ) -#else /* ! LDAP_NULL_IS_NULL */ - } else if ( ber_scanf( &tmpber, "{eaa}", &lderr, - &lr->lr_res_matched, &lr_res_error ) - != LBER_ERROR ) -#endif /* ! LDAP_NULL_IS_NULL */ { if ( lr_res_error != NULL ) { -#ifndef LDAP_NULL_IS_NULL - if ( lr_res_error[ 0 ] == '\0' ) { - LDAP_FREE( lr_res_error ); - } else -#endif /* ! LDAP_NULL_IS_NULL */ { if ( lr->lr_res_error != NULL ) { (void)ldap_append_referral( ld, &lr->lr_res_error, lr_res_error ); diff --git a/libraries/libldap/sasl.c b/libraries/libldap/sasl.c index 2084095882..0624394c3f 100644 --- a/libraries/libldap/sasl.c +++ b/libraries/libldap/sasl.c @@ -294,13 +294,8 @@ ldap_parse_sasl_bind_result( } if ( ld->ld_version < LDAP_VERSION2 ) { -#ifdef LDAP_NULL_IS_NULL tag = ber_scanf( ber, "{iA}", &errcode, &ld->ld_error ); -#else /* ! LDAP_NULL_IS_NULL */ - tag = ber_scanf( ber, "{ia}", - &errcode, &ld->ld_error ); -#endif /* ! LDAP_NULL_IS_NULL */ if( tag == LBER_ERROR ) { ber_free( ber, 0 ); @@ -311,13 +306,8 @@ ldap_parse_sasl_bind_result( } else { ber_len_t len; -#ifdef LDAP_NULL_IS_NULL tag = ber_scanf( ber, "{eAA" /*}*/, &errcode, &ld->ld_matched, &ld->ld_error ); -#else /* ! LDAP_NULL_IS_NULL */ - tag = ber_scanf( ber, "{eaa" /*}*/, - &errcode, &ld->ld_matched, &ld->ld_error ); -#endif /* ! LDAP_NULL_IS_NULL */ if( tag == LBER_ERROR ) { ber_free( ber, 0 ); diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index ed478507ef..3350c915fa 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -949,16 +949,6 @@ retry:; default: rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err, &match, &text, NULL, NULL, 1 ); -#ifndef LDAP_NULL_IS_NULL - if ( match != NULL && match[ 0 ] == '\0' ) { - ldap_memfree( match ); - match = NULL; - } - if ( text != NULL && text[ 0 ] == '\0' ) { - ldap_memfree( text ); - text = NULL; - } -#endif /* LDAP_NULL_IS_NULL */ rs->sr_text = text; if ( rc != LDAP_SUCCESS ) { rs->sr_err = rc; diff --git a/servers/slapd/back-ldap/extended.c b/servers/slapd/back-ldap/extended.c index de7a1c7ad1..5e0c2682c7 100644 --- a/servers/slapd/back-ldap/extended.c +++ b/servers/slapd/back-ldap/extended.c @@ -143,16 +143,6 @@ retry: (char **)&rs->sr_matched, (char **)&rs->sr_text, NULL, NULL, 0 ); -#ifndef LDAP_NULL_IS_NULL - if ( rs->sr_matched && rs->sr_matched[ 0 ] == '\0' ) { - free( (char *)rs->sr_matched ); - rs->sr_matched = NULL; - } - if ( rs->sr_text && rs->sr_text[ 0 ] == '\0' ) { - free( (char *)rs->sr_text ); - rs->sr_text = NULL; - } -#endif /* LDAP_NULL_IS_NULL */ if ( rc == LDAP_SUCCESS ) { if ( rs->sr_err == LDAP_SUCCESS ) { @@ -250,16 +240,6 @@ retry: (char **)&rs->sr_matched, (char **)&rs->sr_text, NULL, NULL, 0 ); -#ifndef LDAP_NULL_IS_NULL - if ( rs->sr_matched && rs->sr_matched[ 0 ] == '\0' ) { - free( (char *)rs->sr_matched ); - rs->sr_matched = NULL; - } - if ( rs->sr_text && rs->sr_text[ 0 ] == '\0' ) { - free( (char *)rs->sr_text ); - rs->sr_text = NULL; - } -#endif /* LDAP_NULL_IS_NULL */ if ( rc == LDAP_SUCCESS ) { if ( rs->sr_err == LDAP_SUCCESS ) { rc = ldap_parse_extended_result( lc->lc_ld, res, diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 2be811f1fa..24cda24f57 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -412,22 +412,10 @@ retry: } if ( match.bv_val != NULL ) { -#ifndef LDAP_NULL_IS_NULL - if ( match.bv_val[ 0 ] == '\0' ) { - LDAP_FREE( match.bv_val ); - BER_BVZERO( &match ); - } else -#endif /* LDAP_NULL_IS_NULL */ { match.bv_len = strlen( match.bv_val ); } } -#ifndef LDAP_NULL_IS_NULL - if ( rs->sr_text != NULL && rs->sr_text[ 0 ] == '\0' ) { - LDAP_FREE( (char *)rs->sr_text ); - rs->sr_text = NULL; - } -#endif /* LDAP_NULL_IS_NULL */ /* cleanup */ if ( references ) { diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index 668f8c9447..729db9cd73 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -598,13 +598,6 @@ really_bad:; /* massage matchedDN if need be */ if ( candidates[ i ].sr_matched != NULL ) { -#ifndef LDAP_NULL_IS_NULL - if ( candidates[ i ].sr_matched[ 0 ] == '\0' ) { - ldap_memfree( (char *)candidates[ i ].sr_matched ); - candidates[ i ].sr_matched = NULL; - - } else -#endif /* LDAP_NULL_IS_NULL */ { struct berval match, mmatch; @@ -628,14 +621,6 @@ really_bad:; } } -#ifndef LDAP_NULL_IS_NULL - /* just get rid of the error message, if any */ - if ( candidates[ i ].sr_text && candidates[ i ].sr_text[ 0 ] == '\0' ) - { - ldap_memfree( (char *)candidates[ i ].sr_text ); - candidates[ i ].sr_text = NULL; - } -#endif /* LDAP_NULL_IS_NULL */ /* add references to array */ if ( references ) { -- 2.39.5