unifdef -DLDAP_NULL_IS_NULL

This commit is contained in:
Kurt Zeilenga 2006-02-14 23:18:12 +00:00
parent 727a16ca55
commit cbc11c9233
10 changed files with 0 additions and 125 deletions

View 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 */

View 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 );

View 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 );
}

View 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 );
}

View 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 );

View 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 );

View 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;

View 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,

View 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 ) {

View 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 ) {