Remove useless asserts that will be re-assert()ed before the variable is used

This commit is contained in:
Hallvard Furuseth 2009-07-29 15:06:28 +00:00
parent 12a6f3e055
commit 53f884ac1d
2 changed files with 1 additions and 73 deletions

View File

@ -146,9 +146,7 @@ ber_skip_tag( BerElement *ber, ber_len_t *len )
ber_len_t i, noctets; ber_len_t i, noctets;
unsigned char netlen[sizeof(ber_len_t)]; unsigned char netlen[sizeof(ber_len_t)];
assert( ber != NULL );
assert( len != NULL ); assert( len != NULL );
assert( LBER_VALID( ber ) );
/* /*
* Any ber element looks like this: tag length contents. * Any ber element looks like this: tag length contents.
@ -240,9 +238,7 @@ ber_getnint(
{ {
unsigned char buf[sizeof(ber_int_t)]; unsigned char buf[sizeof(ber_int_t)];
assert( ber != NULL );
assert( num != NULL ); assert( num != NULL );
assert( LBER_VALID( ber ) );
/* /*
* The tag and length have already been stripped off. We should * The tag and length have already been stripped off. We should
@ -288,9 +284,6 @@ ber_get_int(
ber_tag_t tag; ber_tag_t tag;
ber_len_t len; ber_len_t len;
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT ) { if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT ) {
return LBER_DEFAULT; return LBER_DEFAULT;
} }
@ -319,9 +312,6 @@ ber_get_stringb(
ber_len_t datalen; ber_len_t datalen;
ber_tag_t tag; ber_tag_t tag;
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT ) { if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT ) {
return LBER_DEFAULT; return LBER_DEFAULT;
} }
@ -487,11 +477,8 @@ ber_get_stringbv( BerElement *ber, struct berval *bv, int option )
{ {
ber_tag_t tag; ber_tag_t tag;
assert( ber != NULL );
assert( bv != NULL ); assert( bv != NULL );
assert( LBER_VALID( ber ) );
if ( (tag = ber_skip_tag( ber, &bv->bv_len )) == LBER_DEFAULT ) { if ( (tag = ber_skip_tag( ber, &bv->bv_len )) == LBER_DEFAULT ) {
bv->bv_val = NULL; bv->bv_val = NULL;
return LBER_DEFAULT; return LBER_DEFAULT;
@ -531,11 +518,8 @@ ber_get_stringbv_null( BerElement *ber, struct berval *bv, int option )
{ {
ber_tag_t tag; ber_tag_t tag;
assert( ber != NULL );
assert( bv != NULL ); assert( bv != NULL );
assert( LBER_VALID( ber ) );
if ( (tag = ber_skip_tag( ber, &bv->bv_len )) == LBER_DEFAULT ) { if ( (tag = ber_skip_tag( ber, &bv->bv_len )) == LBER_DEFAULT ) {
bv->bv_val = NULL; bv->bv_val = NULL;
return LBER_DEFAULT; return LBER_DEFAULT;
@ -636,12 +620,9 @@ ber_get_bitstringa(
ber_tag_t tag; ber_tag_t tag;
unsigned char unusedbits; unsigned char unusedbits;
assert( ber != NULL );
assert( buf != NULL ); assert( buf != NULL );
assert( blen != NULL ); assert( blen != NULL );
assert( LBER_VALID( ber ) );
if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT ) { if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT ) {
*buf = NULL; *buf = NULL;
return LBER_DEFAULT; return LBER_DEFAULT;
@ -676,9 +657,6 @@ ber_get_null( BerElement *ber )
ber_len_t len; ber_len_t len;
ber_tag_t tag; ber_tag_t tag;
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT ) { if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT ) {
return LBER_DEFAULT; return LBER_DEFAULT;
} }
@ -699,11 +677,8 @@ ber_get_boolean(
ber_int_t longbool; ber_int_t longbool;
ber_tag_t rc; ber_tag_t rc;
assert( ber != NULL );
assert( boolval != NULL ); assert( boolval != NULL );
assert( LBER_VALID( ber ) );
rc = ber_get_int( ber, &longbool ); rc = ber_get_int( ber, &longbool );
*boolval = longbool; *boolval = longbool;
@ -716,8 +691,6 @@ ber_first_element(
ber_len_t *len, ber_len_t *len,
char **last ) char **last )
{ {
assert( ber != NULL );
assert( len != NULL );
assert( last != NULL ); assert( last != NULL );
/* skip the sequence header, use the len to mark where to stop */ /* skip the sequence header, use the len to mark where to stop */
@ -745,7 +718,6 @@ ber_next_element(
assert( ber != NULL ); assert( ber != NULL );
assert( len != NULL ); assert( len != NULL );
assert( last != NULL ); assert( last != NULL );
assert( LBER_VALID( ber ) ); assert( LBER_VALID( ber ) );
if ( ber->ber_ptr >= last ) { if ( ber->ber_ptr >= last ) {
@ -775,7 +747,6 @@ ber_scanf ( BerElement *ber,
assert( ber != NULL ); assert( ber != NULL );
assert( fmt != NULL ); assert( fmt != NULL );
assert( LBER_VALID( ber ) ); assert( LBER_VALID( ber ) );
fmt_reset = fmt; fmt_reset = fmt;
@ -944,6 +915,7 @@ ber_scanf ( BerElement *ber,
} }
va_end( ap ); va_end( ap );
if ( rc == LBER_DEFAULT ) { if ( rc == LBER_DEFAULT ) {
/* /*
* Error. Reclaim malloced memory that was given to the caller. * Error. Reclaim malloced memory that was given to the caller.

View File

@ -247,9 +247,6 @@ ber_put_int_or_enum(
ber_uint_t unum, mask; ber_uint_t unum, mask;
unsigned char netnum[sizeof(ber_uint_t)]; unsigned char netnum[sizeof(ber_uint_t)];
assert( ber != NULL );
assert( LBER_VALID( ber ) );
sign = (num < 0); sign = (num < 0);
unum = num; /* Bit fiddling should be done with unsigned values */ unum = num; /* Bit fiddling should be done with unsigned values */
@ -307,9 +304,6 @@ ber_put_enum(
ber_int_t num, ber_int_t num,
ber_tag_t tag ) ber_tag_t tag )
{ {
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if ( tag == LBER_DEFAULT ) { if ( tag == LBER_DEFAULT ) {
tag = LBER_ENUMERATED; tag = LBER_ENUMERATED;
} }
@ -323,9 +317,6 @@ ber_put_int(
ber_int_t num, ber_int_t num,
ber_tag_t tag ) ber_tag_t tag )
{ {
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if ( tag == LBER_DEFAULT ) { if ( tag == LBER_DEFAULT ) {
tag = LBER_INTEGER; tag = LBER_INTEGER;
} }
@ -342,11 +333,6 @@ ber_put_ostring(
{ {
int taglen, lenlen, rc; int taglen, lenlen, rc;
assert( ber != NULL );
assert( str != NULL );
assert( LBER_VALID( ber ) );
if ( tag == LBER_DEFAULT ) { if ( tag == LBER_DEFAULT ) {
tag = LBER_OCTETSTRING; tag = LBER_OCTETSTRING;
} }
@ -372,9 +358,6 @@ ber_put_berval(
struct berval *bv, struct berval *bv,
ber_tag_t tag ) ber_tag_t tag )
{ {
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if( bv == NULL || bv->bv_len == 0 ) { if( bv == NULL || bv->bv_len == 0 ) {
return ber_put_ostring( ber, "", (ber_len_t) 0, tag ); return ber_put_ostring( ber, "", (ber_len_t) 0, tag );
} }
@ -388,11 +371,8 @@ ber_put_string(
LDAP_CONST char *str, LDAP_CONST char *str,
ber_tag_t tag ) ber_tag_t tag )
{ {
assert( ber != NULL );
assert( str != NULL ); assert( str != NULL );
assert( LBER_VALID( ber ) );
return ber_put_ostring( ber, str, strlen( str ), tag ); return ber_put_ostring( ber, str, strlen( str ), tag );
} }
@ -407,11 +387,6 @@ ber_put_bitstring(
ber_len_t len; ber_len_t len;
unsigned char unusedbits; unsigned char unusedbits;
assert( ber != NULL );
assert( str != NULL );
assert( LBER_VALID( ber ) );
if ( tag == LBER_DEFAULT ) { if ( tag == LBER_DEFAULT ) {
tag = LBER_BITSTRING; tag = LBER_BITSTRING;
} }
@ -443,9 +418,6 @@ ber_put_null( BerElement *ber, ber_tag_t tag )
{ {
int taglen; int taglen;
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if ( tag == LBER_DEFAULT ) { if ( tag == LBER_DEFAULT ) {
tag = LBER_NULL; tag = LBER_NULL;
} }
@ -470,9 +442,6 @@ ber_put_boolean(
int taglen; int taglen;
unsigned char c; unsigned char c;
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if ( tag == LBER_DEFAULT ) if ( tag == LBER_DEFAULT )
tag = LBER_BOOLEAN; tag = LBER_BOOLEAN;
@ -531,9 +500,6 @@ ber_start_seqorset(
int int
ber_start_seq( BerElement *ber, ber_tag_t tag ) ber_start_seq( BerElement *ber, ber_tag_t tag )
{ {
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if ( tag == LBER_DEFAULT ) { if ( tag == LBER_DEFAULT ) {
tag = LBER_SEQUENCE; tag = LBER_SEQUENCE;
} }
@ -544,9 +510,6 @@ ber_start_seq( BerElement *ber, ber_tag_t tag )
int int
ber_start_set( BerElement *ber, ber_tag_t tag ) ber_start_set( BerElement *ber, ber_tag_t tag )
{ {
assert( ber != NULL );
assert( LBER_VALID( ber ) );
if ( tag == LBER_DEFAULT ) { if ( tag == LBER_DEFAULT ) {
tag = LBER_SET; tag = LBER_SET;
} }
@ -716,18 +679,12 @@ ber_put_seqorset( BerElement *ber )
int int
ber_put_seq( BerElement *ber ) ber_put_seq( BerElement *ber )
{ {
assert( ber != NULL );
assert( LBER_VALID( ber ) );
return ber_put_seqorset( ber ); return ber_put_seqorset( ber );
} }
int int
ber_put_set( BerElement *ber ) ber_put_set( BerElement *ber )
{ {
assert( ber != NULL );
assert( LBER_VALID( ber ) );
return ber_put_seqorset( ber ); return ber_put_seqorset( ber );
} }
@ -747,7 +704,6 @@ ber_printf( BerElement *ber, LDAP_CONST char *fmt, ... )
assert( ber != NULL ); assert( ber != NULL );
assert( fmt != NULL ); assert( fmt != NULL );
assert( LBER_VALID( ber ) ); assert( LBER_VALID( ber ) );
va_start( ap, fmt ); va_start( ap, fmt );