]> git.sur5r.net Git - openldap/commitdiff
axe mr_ptr in favor or schema_prep
authorKurt Zeilenga <kurt@openldap.org>
Thu, 27 Feb 2003 03:29:07 +0000 (03:29 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 27 Feb 2003 03:29:07 +0000 (03:29 +0000)
servers/slapd/schema_init.c
servers/slapd/schema_prep.c
servers/slapd/slap.h

index 1822e719e5372ae22cb9f04343bb55bdd025526f..37d291ba886701ba682f095dc9b6005d1b431988 100644 (file)
 #define telephoneNumberSubstringsIndexer       caseIgnoreIA5SubstringsIndexer
 #define telephoneNumberSubstringsFilter                caseIgnoreIA5SubstringsFilter
 
-static MatchingRule *caseExactMatchingRule;
-static MatchingRule *caseExactSubstringsMatchingRule;
-static MatchingRule *integerFirstComponentMatchingRule;
-
-static const struct MatchingRulePtr {
-       const char   *oid;
-       MatchingRule **mr;
-} mr_ptr [] = {
-       /* must match OIDs below */
-       { "2.5.13.5",  &caseExactMatchingRule },
-       { "2.5.13.7",  &caseExactSubstringsMatchingRule },
-       { "2.5.13.29", &integerFirstComponentMatchingRule }
-};
-
-
 static char *bvcasechr( struct berval *bv, unsigned char c, ber_len_t *len )
 {
        ber_len_t i;
@@ -1102,7 +1087,7 @@ caseExactIgnoreSubstringsMatch(
        char *nav = NULL;
        unsigned casefold;
 
-       casefold = ( mr != caseExactSubstringsMatchingRule )
+       casefold = ( mr != slap_schema.si_mr_caseExactSubstringsMatch )
                ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD;
 
        if ( UTF8bvnormalize( value, &left, casefold ) == NULL ) {
@@ -1272,7 +1257,7 @@ static int caseExactIgnoreIndexer(
        slen = syntax->ssyn_oidlen;
        mlen = mr->smr_oidlen;
 
-       casefold = ( mr != caseExactMatchingRule )
+       casefold = ( mr != slap_schema.si_mr_caseExactMatch )
                ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD;
 
        for( i=0; values[i].bv_val != NULL; i++ ) {
@@ -1349,7 +1334,7 @@ static int caseExactIgnoreFilter(
        slen = syntax->ssyn_oidlen;
        mlen = mr->smr_oidlen;
 
-       casefold = ( mr != caseExactMatchingRule )
+       casefold = ( mr != slap_schema.si_mr_caseExactMatch )
                ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD;
 
        UTF8bvnormalize( (struct berval *) assertedValue, &value, casefold );
@@ -1415,7 +1400,7 @@ static int caseExactIgnoreSubstringsIndexer(
        /* we should have at least one value at this point */
        assert( i > 0 );
 
-       casefold = ( mr != caseExactSubstringsMatchingRule )
+       casefold = ( mr != slap_schema.si_mr_caseExactSubstringsMatch )
                ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD;
 
        tvalues = ch_malloc( sizeof( struct berval ) * (i+1) );
@@ -1616,7 +1601,7 @@ static int caseExactIgnoreSubstringsFilter(
        struct berval *value;
        struct berval digest;
 
-       casefold = ( mr != caseExactSubstringsMatchingRule )
+       casefold = ( mr != slap_schema.si_mr_caseExactSubstringsMatch )
                ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD;
 
        sa = UTF8SubstringsassertionNormalize( assertedValue, casefold );
@@ -1875,7 +1860,7 @@ integerMatch(
        /* Skip leading space/sign/zeroes, and get the sign of the *value number */
        v = value->bv_val;
        vlen = value->bv_len;
-       if( mr == integerFirstComponentMatchingRule ) {
+       if( mr == slap_schema.si_mr_integerFirstComponentMatch ) {
                char *tmp = memchr( v, '$', vlen );
                if( tmp )
                        vlen = tmp - v;
@@ -4847,7 +4832,7 @@ slap_schema_init( void )
                        mrule_defs[i].mrd_compat_syntaxes == NULL )
                {
                        fprintf( stderr,
-                               "slap_schema_init: Ingoring unusable matching rule %s\n",
+                               "slap_schema_init: Ignoring unusable matching rule %s\n",
                                 mrule_defs[i].mrd_desc );
                        continue;
                }
@@ -4862,9 +4847,6 @@ slap_schema_init( void )
                }
        }
 
-       for ( i=0; i < (int)(sizeof(mr_ptr)/sizeof(mr_ptr[0])); i++ )
-               *mr_ptr[i].mr = mr_find( mr_ptr[i].oid );
-
        res = slap_schema_load();
        schema_init_done = 1;
        return res;
@@ -4877,8 +4859,6 @@ schema_destroy( void )
        oidm_destroy();
        oc_destroy();
        at_destroy();
-       for ( i=0; i < (int)(sizeof(mr_ptr)/sizeof(mr_ptr[0])); i++ )
-               *mr_ptr[i].mr = NULL;
        mr_destroy();
        mru_destroy();
        syn_destroy();
index 4d13356fb08b6bffd9231f4afa64d63c006e5e3a..abb2b2217a04f597ccad3f261ec4ecc4ffc33358 100644 (file)
@@ -796,10 +796,17 @@ static struct slap_schema_mr_map {
        char *ssmm_name;
        size_t ssmm_offset;
 } mr_map[] = {
+       { "caseExactMatch",
+               offsetof(struct slap_internal_schema, si_mr_caseExactMatch) },
+       { "caseExactSubstringsMatch",
+               offsetof(struct slap_internal_schema, si_mr_caseExactSubstringsMatch) },
        { "distinguishedNameMatch",
                offsetof(struct slap_internal_schema, si_mr_distinguishedNameMatch) },
        { "integerMatch",
                offsetof(struct slap_internal_schema, si_mr_integerMatch) },
+       { "integerFirstComponentMatch",
+               offsetof(struct slap_internal_schema,
+                       si_mr_integerFirstComponentMatch) },
        { NULL, 0 }
 };
 
index 9dea20e0aacbf203ddce887ed69de49a0a32f87d..8d033a96a2161776b132591dcebe02fc07080539 100644 (file)
@@ -790,7 +790,10 @@ struct slap_internal_schema {
 
        /* Matching Rules */
        MatchingRule    *si_mr_distinguishedNameMatch;
+       MatchingRule    *si_mr_caseExactMatch;
+       MatchingRule    *si_mr_caseExactSubstringsMatch;
        MatchingRule    *si_mr_integerMatch;
+       MatchingRule    *si_mr_integerFirstComponentMatch;
 
        /* Syntaxes */
        Syntax          *si_syn_octetString;