]> git.sur5r.net Git - openldap/commitdiff
unifdef -DLDAP_NULL_IS_NULL
authorKurt Zeilenga <kurt@openldap.org>
Tue, 14 Feb 2006 23:18:12 +0000 (23:18 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 14 Feb 2006 23:18:12 +0000 (23:18 +0000)
include/lber.h
libraries/liblber/decode.c
libraries/libldap/error.c
libraries/libldap/extended.c
libraries/libldap/result.c
libraries/libldap/sasl.c
servers/slapd/back-ldap/bind.c
servers/slapd/back-ldap/extended.c
servers/slapd/back-ldap/search.c
servers/slapd/back-meta/search.c

index 460e0c260300b69492baf21d53a5fc93c2e74c01..3017d56181602970f5b11488d56c9e5f2276fdb1 100644 (file)
@@ -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 */
index a874c06765c66ec69ed4e6345541c441fa1bf953..3ff84d34b80dbd39fa4f5297ddaee264d7b0c842 100644 (file)
@@ -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 );
index b102d4ab77e376e599cd2ec07c52dca94d2c79f9..825c4ec0d032a40d6ff860bd2fc2172d2ca99c58 100644 (file)
@@ -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 );
                        }
index 345f48a297987cced78ec36d9afcb2b5fb5c0ec0..6afc1d7f63087cd56f060a112bab2a5154aeae3c 100644 (file)
@@ -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 );
        }
index ad3263d3927b4f3d1ff4b0f09ee290e1a07dba01..a3fec31dcb69dead09f3e33010b7e01531ed098a 100644 (file)
@@ -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 );
index 20840958822fbda334f52b336dc502cf47bdc3a5..0624394c3f859c05037a065de7f738aabe6478a9 100644 (file)
@@ -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 );
index ed478507eff9bff3c01a0dd49beacc998b8be78d..3350c915fa0aa18d6e53405e73ec16d4d1bdd237 100644 (file)
@@ -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;
index de7a1c7ad132e92de4d39d94bb93de6fda5bb0f5..5e0c2682c75e7017e9d59dcb4fc126b9fc1aba8e 100644 (file)
@@ -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,
index 2be811f1faad92907173adf33d03a4849e0690d2..24cda24f5795cd6b6a12476c65239fdf4fa1e5dc 100644 (file)
@@ -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 ) {
index 668f8c94473707c29bf48f551afafcba9e9eff5b..729db9cd73e227c44fb36e881711cdf2955486a9 100644 (file)
@@ -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 ) {