Precompute syn_oidlen and mr_oidlen

This commit is contained in:
Howard Chu 2001-12-26 14:36:02 +00:00
parent 15f630545a
commit 3da3be8128
4 changed files with 32 additions and 28 deletions

View File

@ -139,6 +139,7 @@ mr_add(
smr = (MatchingRule *) ch_calloc( 1, sizeof(MatchingRule) );
AC_MEMCPY( &smr->smr_mrule, mr, sizeof(LDAPMatchingRule));
smr->smr_oidlen = strlen( mr->mr_oid );
smr->smr_usage = usage;
smr->smr_convert = convert;
smr->smr_normalize = normalize;

View File

@ -144,8 +144,8 @@ static int octetStringIndexer(
keys = ch_malloc( sizeof( struct berval * ) * (i+1) );
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
for( i=0; values[i] != NULL; i++ ) {
HASH_Init( &HASHcontext );
@ -190,8 +190,8 @@ static int octetStringFilter(
digest.bv_val = HASHdigest;
digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
keys = ch_malloc( sizeof( struct berval * ) * 2 );
@ -1190,8 +1190,8 @@ static int caseExactIgnoreIndexer(
keys = ch_malloc( sizeof( struct berval * ) * (i+1) );
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
casefold = strcmp( mr->smr_oid, caseExactMatchOID )
? UTF8_CASEFOLD : UTF8_NOCASEFOLD;
@ -1244,8 +1244,8 @@ static int caseExactIgnoreFilter(
digest.bv_val = HASHdigest;
digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
casefold = strcmp( mr->smr_oid, caseExactMatchOID )
? UTF8_CASEFOLD : UTF8_NOCASEFOLD;
@ -1365,8 +1365,8 @@ static int caseExactIgnoreSubstringsIndexer(
keys = ch_malloc( sizeof( struct berval * ) * (nkeys+1) );
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
nkeys=0;
for( i=0; values[i] != NULL; i++ ) {
@ -1531,8 +1531,8 @@ static int caseExactIgnoreSubstringsFilter(
digest.bv_val = HASHdigest;
digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
keys = ch_malloc( sizeof( struct berval * ) * (nkeys+1) );
nkeys = 0;
@ -2231,8 +2231,8 @@ static int caseExactIA5Indexer(
keys = ch_malloc( sizeof( struct berval * ) * (i+1) );
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
for( i=0; values[i] != NULL; i++ ) {
struct berval *value = values[i];
@ -2277,8 +2277,8 @@ static int caseExactIA5Filter(
digest.bv_val = HASHdigest;
digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
value = (struct berval *) assertValue;
@ -2366,8 +2366,8 @@ static int caseExactIA5SubstringsIndexer(
keys = ch_malloc( sizeof( struct berval * ) * (nkeys+1) );
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
nkeys=0;
for( i=0; values[i] != NULL; i++ ) {
@ -2515,8 +2515,8 @@ static int caseExactIA5SubstringsFilter(
digest.bv_val = HASHdigest;
digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
keys = ch_malloc( sizeof( struct berval * ) * (nkeys+1) );
nkeys = 0;
@ -2797,8 +2797,8 @@ static int caseIgnoreIA5Indexer(
keys = ch_malloc( sizeof( struct berval * ) * (i+1) );
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
for( i=0; values[i] != NULL; i++ ) {
struct berval *value = ber_bvdup( values[i] );
@ -2846,8 +2846,8 @@ static int caseIgnoreIA5Filter(
digest.bv_val = HASHdigest;
digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
value = ber_bvdup( (struct berval *) assertValue );
ldap_pvt_str2upper( value->bv_val );
@ -2939,8 +2939,8 @@ static int caseIgnoreIA5SubstringsIndexer(
keys = ch_malloc( sizeof( struct berval * ) * (nkeys+1) );
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
nkeys=0;
for( i=0; values[i] != NULL; i++ ) {
@ -3092,8 +3092,8 @@ static int caseIgnoreIA5SubstringsFilter(
digest.bv_val = HASHdigest;
digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
slen = syntax->ssyn_oidlen;
mlen = mr->smr_oidlen;
keys = ch_malloc( sizeof( struct berval * ) * (nkeys+1) );
nkeys = 0;

View File

@ -254,6 +254,7 @@ typedef struct slap_syntax {
#define ssyn_oid ssyn_syn.syn_oid
#define ssyn_desc ssyn_syn.syn_desc
#define ssyn_extensions ssyn_syn.syn_extensions
ber_len_t ssyn_oidlen;
unsigned ssyn_flags;
@ -326,6 +327,7 @@ typedef int slap_mr_filter_func LDAP_P((
typedef struct slap_matching_rule {
LDAPMatchingRule smr_mrule;
ber_len_t smr_oidlen;
slap_mask_t smr_usage;
#define SLAP_MR_TYPE_MASK 0xFF00U

View File

@ -134,6 +134,7 @@ syn_add(
ssyn->ssyn_next = NULL;
ssyn->ssyn_oidlen = strlen(syn->syn_oid);
ssyn->ssyn_flags = flags;
ssyn->ssyn_validate = validate;
ssyn->ssyn_normalize = normalize;