[Date Prev][Date Next] [Chronological] [Thread] [Top]

removing duplicated code from schema_init.c

With the new code for Match/Index/Filter in schema_init.c it is
easy to remove a lot of duplicated code.

For instance caseExactSubstringsMatch() and caseExactSubstringsMatch()
are both 145 lines long, and the only difference between them is
the following:

nav = UTF8normalize( value->bv_val, UTF8_NOCASEFOLD );
sub = UTF8SubstringsassertionNormalize( assertedValue, UTF8_NOCASEFOLD );


nav = UTF8normalize( value->bv_val, UTF8_CASEFOLD );
sub = UTF8SubstringsassertionNormalize( assertedValue, UTF8_CASEFOLD );

I'm thinking of replacing those two with a new
caseExactIgnoreSubstringsMatch() that is basically identical. I'm
thinking of doing

casefold = strcmp( *mr->smr_mrule.mr_names, "caseIgnoreMatch" )

The rest of the code would be untouched except for replacing the macros
with casefold.

What do you think? Is this fine? Is there a better way? In my mind it
is cleaner to use the MR name than the oid.

Another solution would be to have wrapper routines
caseExactSubstringsMatch() and caseExactSubstringsMatch() that call
a common routine with casefold as parameter. I like the first one

I thought I should check if anyone thought it was a bad idea before I
did it.