struct berval *normalized )
{
char *p, *q, *s;
+ int len = 0;
p = val->bv_val;
/* Ignore initial whitespace */
- while ( ldap_utf8_isspace( p ) ) {
- LDAP_UTF8_INCR( p );
+ /* All space is ASCII. All ASCII is 1 byte */
+ while ( ASCII_SPACE( *p ) ) {
+ p++;
}
if( *p == '\0' ) {
s = NULL;
while ( *p ) {
- int len;
-
- if ( ldap_utf8_isspace( p ) ) {
- len = LDAP_UTF8_COPY(q,p);
- s=q;
- p+=len;
- q+=len;
+ q += len;
+ if ( ASCII_SPACE( *p ) ) {
+ s = q - len;
+ len = 1;
+ *q = *p++;
/* Ignore the extra whitespace */
- while ( ldap_utf8_isspace( p ) ) {
- LDAP_UTF8_INCR( p );
+ while ( ASCII_SPACE( *p ) ) {
+ p++;
}
} else {
len = LDAP_UTF8_COPY(q,p);
s=NULL;
p+=len;
- q+=len;
}
}
assert( normalized->bv_val < p );
- assert( q <= p );
+ assert( q+len <= p );
/* cannot start with a space */
- assert( !ldap_utf8_isspace(normalized->bv_val) );
+ assert( !ASCII_SPACE(normalized->bv_val[0]) );
/*
* If the string ended in space, backup the pointer one
*/
if ( s != NULL ) {
+ len = q - s;
q = s;
}
/* cannot end with a space */
- assert( !ldap_utf8_isspace( LDAP_UTF8_PREV(q) ) );
+ assert( !ASCII_SPACE( *q ) );
+
+ q += len;
/* null terminate */
*q = '\0';
return LDAP_SUCCESS;
}
-/* Returns Unicode cannonically normalized copy of a substring assertion
+/* Returns Unicode canonically normalized copy of a substring assertion
* Skipping attribute description */
static SubstringsAssertion *
UTF8SubstringsassertionNormalize(
return nsa;
err:
- free( nsa->sa_final.bv_val );
- bvarray_free( nsa->sa_any );
- free( nsa->sa_initial.bv_val );
+ if ( nsa->sa_final.bv_val ) free( nsa->sa_final.bv_val );
+ if ( nsa->sa_any )bvarray_free( nsa->sa_any );
+ if ( nsa->sa_initial.bv_val ) free( nsa->sa_initial.bv_val );
ch_free( nsa );
return NULL;
}
if( idx >= left.bv_len ) {
/* this shouldn't happen */
free( nav );
- ch_free( sub->sa_final.bv_val );
- bvarray_free( sub->sa_any );
- ch_free( sub->sa_initial.bv_val );
+ if ( sub->sa_final.bv_val )
+ ch_free( sub->sa_final.bv_val );
+ if ( sub->sa_any )
+ bvarray_free( sub->sa_any );
+ if ( sub->sa_initial.bv_val )
+ ch_free( sub->sa_initial.bv_val );
ch_free( sub );
return LDAP_OTHER;
}
done:
free( nav );
if( sub != NULL ) {
- free( sub->sa_final.bv_val );
- bvarray_free( sub->sa_any );
- free( sub->sa_initial.bv_val );
+ if ( sub->sa_final.bv_val ) free( sub->sa_final.bv_val );
+ if ( sub->sa_any ) bvarray_free( sub->sa_any );
+ if ( sub->sa_initial.bv_val ) free( sub->sa_initial.bv_val );
ch_free( sub );
}
*matchp = match;
}
if( nkeys == 0 ) {
- free( sa->sa_final.bv_val );
- bvarray_free( sa->sa_any );
- free( sa->sa_initial.bv_val );
+ if ( sa->sa_final.bv_val ) free( sa->sa_final.bv_val );
+ if ( sa->sa_any ) bvarray_free( sa->sa_any );
+ if ( sa->sa_initial.bv_val ) free( sa->sa_initial.bv_val );
ch_free( sa );
*keysp = NULL;
return LDAP_SUCCESS;
ch_free( keys );
*keysp = NULL;
}
- free( sa->sa_final.bv_val );
- bvarray_free( sa->sa_any );
- free( sa->sa_initial.bv_val );
+ if ( sa->sa_final.bv_val ) free( sa->sa_final.bv_val );
+ if ( sa->sa_any ) bvarray_free( sa->sa_any );
+ if ( sa->sa_initial.bv_val ) free( sa->sa_initial.bv_val );
ch_free( sa );
return LDAP_SUCCESS;
void
schema_destroy( void )
{
+ oidm_destroy();
oc_destroy();
at_destroy();
mr_destroy();