From 42ec7b40b17389dcaf9955fab16f767d7b3b88ae Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 9 Jan 2006 16:22:55 +0000 Subject: [PATCH] Streamline answerability test --- servers/slapd/overlays/pcache.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index 2187beccb2..5a5609baa7 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -879,22 +879,6 @@ get_attr_set( int num ); -static int -is_temp_answerable( - int attr_set, - struct berval* tempstr, - query_manager* qm, - int template_id ) -{ - QueryTemplate *qt = qm->templates + template_id; - - if (attr_set != qt->attr_set_index) { - return 0; - } - return (qt->querystr.bv_len == tempstr->bv_len && - strcasecmp(qt->querystr.bv_val, tempstr->bv_val) == 0); -} - static int filter2template( Operation *op, @@ -1278,14 +1262,15 @@ pcache_op_search( /* check for query containment */ if (attr_set > -1) { - for (i=0; inumtemplates; i++) { + QueryTemplate *qt = qm->templates; + for (i=0; inumtemplates; i++, qt++) { /* find if template i can potentially answer tempstr */ - if (!is_temp_answerable(attr_set, &tempstr, qm, i)) + if ( qt->attr_set_index != attr_set || + qt->querystr.bv_len != tempstr.bv_len || + strcasecmp( qt->querystr.bv_val, tempstr.bv_val )) continue; - if (attr_set == qm->templates[i].attr_set_index) { - cacheable = 1; - template_id = i; - } + cacheable = 1; + template_id = i; Debug( LDAP_DEBUG_NONE, "Entering QC, querystr = %s\n", op->ors_filterstr.bv_val, 0, 0 ); answerable = (*(qm->qcfunc))(qm, &query, i); -- 2.39.5