]> git.sur5r.net Git - openldap/commitdiff
Minor cleanups
authorHoward Chu <hyc@openldap.org>
Wed, 9 Apr 2003 23:37:00 +0000 (23:37 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 9 Apr 2003 23:37:00 +0000 (23:37 +0000)
servers/slapd/ch_malloc.c
servers/slapd/connection.c
servers/slapd/controls.c
servers/slapd/filter.c
servers/slapd/proto-slap.h
servers/slapd/sasl.c
servers/slapd/saslauthz.c
servers/slapd/search.c
servers/slapd/sl_malloc.c
servers/slapd/slap.h
servers/slapd/str2filter.c

index 0b7d1c296a6d3b40f38fbdd5edfa79bfb00f3efe..8084b7e2d0a0d8ed971588bb1412f4a3e2ac5414 100644 (file)
 
 #include "slap.h"
 
-#ifndef CSRIMALLOC
+BerMemoryFunctions ch_mfuncs = {
+       (BER_MEMALLOC_FN *)ch_malloc,
+       (BER_MEMCALLOC_FN *)ch_calloc,
+       (BER_MEMREALLOC_FN *)ch_realloc,
+       (BER_MEMFREE_FN *)ch_free 
+};
 
 void *
 ch_malloc(
@@ -27,7 +32,7 @@ ch_malloc(
 {
        void    *new;
 
-       if ( (new = (void *) ber_memalloc( size )) == NULL ) {
+       if ( (new = (void *) ber_memalloc_x( size, NULL )) == NULL ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR, 
                           "ch_malloc: allocation of %lu bytes failed\n", (long)size, 0,0 );
@@ -58,7 +63,7 @@ ch_realloc(
                ch_free( block );
        }
 
-       if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
+       if ( (new = (void *) ber_memrealloc_x( block, size, NULL )) == NULL ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR, 
                           "ch_realloc: reallocation of %lu bytes failed\n", (long)size, 0,0 );
@@ -81,7 +86,7 @@ ch_calloc(
 {
        void    *new;
 
-       if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
+       if ( (new = (void *) ber_memcalloc_x( nelem, size, NULL )) == NULL ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR, 
                           "ch_calloc: allocation of %lu elements of %lu bytes faild\n",
@@ -104,7 +109,7 @@ ch_strdup(
 {
        char    *new;
 
-       if ( (new = ber_strdup( string )) == NULL ) {
+       if ( (new = ber_strdup_x( string, NULL )) == NULL ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR, 
                        "chr_strdup: duplication of \"%s\" failed\n", string, 0, 0 );
@@ -121,7 +126,6 @@ ch_strdup(
 void
 ch_free( void *ptr )
 {
-       ber_memfree( ptr );
+       ber_memfree_x( ptr, NULL );
 }
 
-#endif
index 432a4b43cac0a73f9afdc1070e0ce1ff7f139784..d81299aad4612c3f819b6cd9374af4f2fa9c3183 100644 (file)
@@ -919,12 +919,10 @@ connection_operation( void *ctx, void *arg_v )
                memctx = sl_mem_create( SLAB_SIZE, ctx );
                ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, memctx );
                op->o_tmpmemctx = memctx;
-               op->o_tmpalloc = sl_malloc;
-               op->o_tmpfree = sl_free;
+               op->o_tmpmfuncs = &sl_mfuncs;
        } else {
                op->o_tmpmemctx = NULL;
-               op->o_tmpalloc = (BER_MEMALLOC_FN *)ch_malloc;
-               op->o_tmpfree = (BER_MEMFREE_FN *)ch_free;
+               op->o_tmpmfuncs = &ch_mfuncs;
        }
 
        switch ( tag ) {
index bf01492aef188d9630e951cac3fc1ae42b56ea88..d7ad0d14985ef391ec128872f8177910b033c248 100644 (file)
@@ -351,9 +351,6 @@ int get_ctrls(
        BerElement *ber = op->o_ber;
        struct slap_control *sc;
        struct berval bv;
-       BER_MEMREALLOC_FN *reallo;
-
-       reallo = op->o_tmpmemctx ? sl_realloc : (BER_MEMREALLOC_FN *)ch_realloc;
 
        len = ber_pvt_ber_remaining(ber);
 
@@ -413,7 +410,7 @@ int get_ctrls(
                /* allocate pointer space for current controls (nctrls)
                 * + this control + extra NULL
                 */
-               tctrls = reallo( op->o_ctrls,
+               tctrls = op->o_tmprealloc( op->o_ctrls,
                        (nctrls+2) * sizeof(LDAPControl *), op->o_tmpmemctx );
 
 #if 0
index 8de5d6e94e3d38b973302932c0faf4d685c1191a..87c10418eb0169060d05baa5c2981b637ad6f11c 100644 (file)
@@ -615,85 +615,83 @@ filter_free( Filter *f )
        Operation op;
 
        op.o_tmpmemctx = NULL;
-       op.o_tmpfree = (BER_MEMFREE_FN *)ch_free;
+       op.o_tmpmfuncs = &ch_mfuncs;
        filter_free_x( &op, f );
 }
 
 void
-filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
+filter2bv_x( Operation *op, Filter *f, struct berval *fstr )
 {
        int     i;
        Filter  *p;
        struct berval tmp;
        ber_len_t len;
-       BER_MEMALLOC_FN *alloc = ctx ? sl_malloc : (BER_MEMALLOC_FN *)ch_malloc;
-       BER_MEMREALLOC_FN *reallo = ctx ? sl_realloc : (BER_MEMREALLOC_FN *)ch_realloc;
 
        if ( f == NULL ) {
-               ber_str2bv_x( "No filter!", sizeof("No filter!")-1, 1, fstr, ctx );
+               ber_str2bv_x( "No filter!", sizeof("No filter!")-1, 1, fstr, op->o_tmpmemctx );
                return;
        }
 
        switch ( f->f_choice ) {
        case LDAP_FILTER_EQUALITY:
-               filter_escape_value_x( &f->f_av_value, &tmp, ctx );
+               filter_escape_value_x( &f->f_av_value, &tmp, op->o_tmpmemctx );
 
                fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
                        tmp.bv_len + ( sizeof("(=)") - 1 );
-               fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
+               fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
 
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)",
                        f->f_av_desc->ad_cname.bv_val,
                        tmp.bv_val );
 
-               ber_memfree_x( tmp.bv_val, ctx );
+               ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
                break;
 
        case LDAP_FILTER_GE:
-               filter_escape_value_x( &f->f_av_value, &tmp, ctx );
+               filter_escape_value_x( &f->f_av_value, &tmp, op->o_tmpmemctx );
 
                fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
                        tmp.bv_len + ( sizeof("(>=)") - 1 );
-               fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
+               fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
 
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)",
                        f->f_av_desc->ad_cname.bv_val,
                        tmp.bv_val );
 
-               ber_memfree_x( tmp.bv_val, ctx );
+               ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
                break;
 
        case LDAP_FILTER_LE:
-               filter_escape_value_x( &f->f_av_value, &tmp, ctx );
+               filter_escape_value_x( &f->f_av_value, &tmp, op->o_tmpmemctx );
 
                fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
                        tmp.bv_len + ( sizeof("(<=)") - 1 );
-               fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
+               fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
 
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)",
                        f->f_av_desc->ad_cname.bv_val,
                        tmp.bv_val );
 
-               ber_memfree_x( tmp.bv_val, ctx );
+               ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
                break;
 
        case LDAP_FILTER_APPROX:
-               filter_escape_value_x( &f->f_av_value, &tmp, ctx );
+               filter_escape_value_x( &f->f_av_value, &tmp, op->o_tmpmemctx );
 
                fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
                        tmp.bv_len + ( sizeof("(~=)") - 1 );
-               fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
+               fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
 
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)",
                        f->f_av_desc->ad_cname.bv_val,
                        tmp.bv_val );
-               ber_memfree_x( tmp.bv_val, ctx );
+               ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
                break;
 
        case LDAP_FILTER_SUBSTRINGS:
                fstr->bv_len = f->f_sub_desc->ad_cname.bv_len +
                        ( sizeof("(=*)") - 1 );
-               fstr->bv_val = alloc( fstr->bv_len + 128, ctx );
+               fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 128, op->o_tmpmemctx );
 
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
                        f->f_sub_desc->ad_cname.bv_val );
@@ -701,46 +699,46 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
                if ( f->f_sub_initial.bv_val != NULL ) {
                        len = fstr->bv_len;
 
-                       filter_escape_value_x( &f->f_sub_initial, &tmp, ctx );
+                       filter_escape_value_x( &f->f_sub_initial, &tmp, op->o_tmpmemctx );
 
                        fstr->bv_len += tmp.bv_len;
-                       fstr->bv_val = reallo( fstr->bv_val, fstr->bv_len + 1, ctx );
+                       fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx );
 
                        snprintf( &fstr->bv_val[len-2], tmp.bv_len+3,
                                /* "(attr=" */ "%s*)",
                                tmp.bv_val );
 
-                       ber_memfree_x( tmp.bv_val, ctx );
+                       ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
                }
 
                if ( f->f_sub_any != NULL ) {
                        for ( i = 0; f->f_sub_any[i].bv_val != NULL; i++ ) {
                                len = fstr->bv_len;
-                               filter_escape_value_x( &f->f_sub_any[i], &tmp, ctx );
+                               filter_escape_value_x( &f->f_sub_any[i], &tmp, op->o_tmpmemctx );
 
                                fstr->bv_len += tmp.bv_len + 1;
-                               fstr->bv_val = reallo( fstr->bv_val, fstr->bv_len + 1, ctx );
+                               fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx );
 
                                snprintf( &fstr->bv_val[len-1], tmp.bv_len+3,
                                        /* "(attr=[init]*[any*]" */ "%s*)",
                                        tmp.bv_val );
-                               ber_memfree_x( tmp.bv_val, ctx );
+                               ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
                        }
                }
 
                if ( f->f_sub_final.bv_val != NULL ) {
                        len = fstr->bv_len;
 
-                       filter_escape_value_x( &f->f_sub_final, &tmp, ctx );
+                       filter_escape_value_x( &f->f_sub_final, &tmp, op->o_tmpmemctx );
 
                        fstr->bv_len += tmp.bv_len;
-                       fstr->bv_val = reallo( fstr->bv_val, fstr->bv_len + 1, ctx );
+                       fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx );
 
                        snprintf( &fstr->bv_val[len-1], tmp.bv_len+3,
                                /* "(attr=[init*][any*]" */ "%s)",
                                tmp.bv_val );
 
-                       ber_memfree_x( tmp.bv_val, ctx );
+                       ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
                }
 
                break;
@@ -748,7 +746,7 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
        case LDAP_FILTER_PRESENT:
                fstr->bv_len = f->f_desc->ad_cname.bv_len +
                        ( sizeof("(=*)") - 1 );
-               fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
+               fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
 
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
                        f->f_desc->ad_cname.bv_val );
@@ -758,7 +756,7 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
        case LDAP_FILTER_OR:
        case LDAP_FILTER_NOT:
                fstr->bv_len = sizeof("(%)") - 1;
-               fstr->bv_val = alloc( fstr->bv_len + 128, ctx );
+               fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 128, op->o_tmpmemctx );
 
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%c)",
                        f->f_choice == LDAP_FILTER_AND ? '&' :
@@ -767,22 +765,22 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
                for ( p = f->f_list; p != NULL; p = p->f_next ) {
                        len = fstr->bv_len;
 
-                       filter2bv( p, &tmp );
+                       filter2bv_x( op, p, &tmp );
                        
                        fstr->bv_len += tmp.bv_len;
-                       fstr->bv_val = reallo( fstr->bv_val, fstr->bv_len + 1, ctx );
+                       fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx );
 
                        snprintf( &fstr->bv_val[len-1], tmp.bv_len + 2, 
                                /*"("*/ "%s)", tmp.bv_val );
 
-                       ch_free( tmp.bv_val );
+                       op->o_tmpfree( tmp.bv_val, op->o_tmpmemctx );
                }
 
                break;
 
        case LDAP_FILTER_EXT: {
                struct berval ad;
-               filter_escape_value_x( &f->f_mr_value, &tmp, ctx );
+               filter_escape_value_x( &f->f_mr_value, &tmp, op->o_tmpmemctx );
 
                if ( f->f_mr_desc ) {
                        ad = f->f_mr_desc->ad_cname;
@@ -795,7 +793,7 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
                        ( f->f_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +
                        ( f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_len+1 : 0 ) +
                        tmp.bv_len + ( sizeof("(:=)") - 1 );
-               fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
+               fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
 
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",
                        ad.bv_val,
@@ -803,7 +801,7 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
                        f->f_mr_rule_text.bv_len ? ":" : "",
                        f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_val : "",
                        tmp.bv_val );
-               ber_memfree_x( tmp.bv_val, ctx );
+               ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
                } break;
 
        case SLAPD_FILTER_COMPUTED:
@@ -816,11 +814,11 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
                        f->f_result == LDAP_COMPARE_TRUE ? sizeof("(?=true)")-1 :
                        f->f_result == SLAPD_COMPARE_UNDEFINED ? sizeof("(?=undefined)")-1 :
                        sizeof("(?=error)")-1,
-                       1, fstr, ctx );
+                       1, fstr, op->o_tmpmemctx );
                break;
 
        default:
-               ber_str2bv_x( "(?=unknown)", sizeof("(?=unknown)")-1, 1, fstr, ctx );
+               ber_str2bv_x( "(?=unknown)", sizeof("(?=unknown)")-1, 1, fstr, op->o_tmpmemctx );
                break;
        }
 }
@@ -828,7 +826,11 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
 void
 filter2bv( Filter *f, struct berval *fstr )
 {
-       filter2bv_x( f, fstr, NULL );
+       Operation op;
+       op.o_tmpmemctx = NULL;
+       op.o_tmpmfuncs = &ch_mfuncs;
+
+       filter2bv_x( &op, f, fstr );
 }
 
 int
index 47709eec27fbcf774c9c12abc1b8f9bf3f00b480..ab25abde09016c2049bbd4c7a22abcc931b98659 100644 (file)
@@ -256,14 +256,7 @@ LDAP_SLAPD_F (int) glue_sub_init( void );
 /*
  * ch_malloc.c
  */
-#ifdef CSRIMALLOC
-#define ch_malloc malloc
-#define ch_realloc realloc
-#define ch_calloc calloc
-#define ch_strdup strdup
-#define ch_free free
-
-#else
+LDAP_SLAPD_V (BerMemoryFunctions) ch_mfuncs;
 LDAP_SLAPD_F (void *) ch_malloc LDAP_P(( ber_len_t size ));
 LDAP_SLAPD_F (void *) ch_realloc LDAP_P(( void *block, ber_len_t size ));
 LDAP_SLAPD_F (void *) ch_calloc LDAP_P(( ber_len_t nelem, ber_len_t size ));
@@ -274,7 +267,6 @@ LDAP_SLAPD_F (void) ch_free LDAP_P(( void * ));
 #undef free
 #define free ch_free
 #endif
-#endif
 
 /*
  * controls.c
@@ -498,7 +490,7 @@ LDAP_SLAPD_F (int) get_filter LDAP_P((
 LDAP_SLAPD_F (void) filter_free LDAP_P(( Filter *f ));
 LDAP_SLAPD_F (void) filter_free_x LDAP_P(( Operation *op, Filter *f ));
 LDAP_SLAPD_F (void) filter2bv LDAP_P(( Filter *f, struct berval *bv ));
-LDAP_SLAPD_F (void) filter2bv_x LDAP_P(( Filter *f, struct berval *bv, void *ctx ));
+LDAP_SLAPD_F (void) filter2bv_x LDAP_P(( Operation *op, Filter *f, struct berval *bv ));
 
 LDAP_SLAPD_F (int) get_vrFilter LDAP_P(( Operation *op, BerElement *ber,
        ValuesReturnFilter **f,
@@ -970,10 +962,12 @@ LDAP_SLAPD_F (int) dscompare LDAP_P(( const char *s1, const char *s2del,
 /*
  * sl_malloc.c
  */
+LDAP_SLAPD_V (BerMemoryFunctions) sl_mfuncs;
 LDAP_SLAPD_F (void *) sl_malloc LDAP_P(( ber_len_t size, void *ctx ));
 LDAP_SLAPD_F (void *) sl_realloc LDAP_P(( void *block, ber_len_t size, void *ctx ));
 LDAP_SLAPD_F (void *) sl_calloc LDAP_P(( ber_len_t nelem, ber_len_t size, void *ctx ));
 LDAP_SLAPD_F (void) sl_free LDAP_P(( void *, void *ctx ));
+LDAP_SLAPD_F (void *) sl_mem_create LDAP_P(( ber_len_t size, void *ctx ));
 
 /*
  * starttls.c
index 96a5b59878fad1a57b32d26eff11155f84901017..0b1e1285db6d2d4228eaa4d5bc1eeee78665661f 100644 (file)
@@ -439,8 +439,7 @@ slap_auxprop_lookup(
                        op.o_is_auth_check = 1;
                        op.o_threadctx = conn->c_sasl_bindop->o_threadctx;
                        op.o_tmpmemctx = conn->c_sasl_bindop->o_tmpmemctx;
-                       op.o_tmpalloc = conn->c_sasl_bindop->o_tmpalloc;
-                       op.o_tmpfree = conn->c_sasl_bindop->o_tmpfree;
+                       op.o_tmpmfuncs = conn->c_sasl_bindop->o_tmpmfuncs;
                        op.o_conn = conn;
                        op.o_connid = conn->c_connid;
                        op.ors_scope = LDAP_SCOPE_BASE;
@@ -565,8 +564,7 @@ slap_sasl_checkpass(
                op.o_is_auth_check = 1;
                op.o_threadctx = conn->c_sasl_bindop->o_threadctx;
                op.o_tmpmemctx = conn->c_sasl_bindop->o_tmpmemctx;
-               op.o_tmpalloc = conn->c_sasl_bindop->o_tmpalloc;
-               op.o_tmpfree = conn->c_sasl_bindop->o_tmpfree;
+               op.o_tmpmfuncs = conn->c_sasl_bindop->o_tmpmfuncs;
                op.o_conn = conn;
                op.o_connid = conn->c_connid;
                op.ors_scope = LDAP_SCOPE_BASE;
index 094523d683fb041721cceddb306cfe3249e0df6f..cea19411cecacd3ac08a88b1848f594001def927 100644 (file)
@@ -452,8 +452,7 @@ int slap_sasl_match(Operation *opx, struct berval *rule, struct berval *assertDN
        op.o_is_auth_check = 1;
        op.o_threadctx = opx->o_threadctx;
        op.o_tmpmemctx = opx->o_tmpmemctx;
-       op.o_tmpalloc = opx->o_tmpalloc;
-       op.o_tmpfree = opx->o_tmpfree;
+       op.o_tmpmfuncs = opx->o_tmpmfuncs;
        op.o_conn = opx->o_conn;
        op.o_connid = opx->o_connid;
 
@@ -614,8 +613,7 @@ void slap_sasl2dn( Operation *opx,
        op.o_is_auth_check = 1;
        op.o_threadctx = opx->o_threadctx;
        op.o_tmpmemctx = opx->o_tmpmemctx;
-       op.o_tmpalloc = opx->o_tmpalloc;
-       op.o_tmpfree = opx->o_tmpfree;
+       op.o_tmpmfuncs = opx->o_tmpmfuncs;
        op.oq_search.rs_deref = LDAP_DEREF_NEVER;
        op.oq_search.rs_slimit = 1;
        op.oq_search.rs_attrsonly = 1;
index 61e4dd8f57df4513630d7fbc3d47a516371dbf47..a6ed0fe18088d11f0a3d020bd5177f86a98eee43 100644 (file)
@@ -145,7 +145,7 @@ do_search(
                }
                goto return_results;
        }
-       filter2bv_x( op->ors_filter, &op->ors_filterstr, op->o_tmpmemctx );
+       filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
 
 #ifdef NEW_LOGGING
        LDAP_LOG( OPERATION, ARGS, 
@@ -478,7 +478,7 @@ static int doSearchRewriteFNs( Operation *op )
                 */
                slapi_pblock_get( op->o_pb, SLAPI_SEARCH_FILTER, (void *)&op->ors_filter);
                op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
-               filter2bv_x( op->ors_filter, &op->ors_filterstr, op->o_tmpmemctx );
+               filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ARGS, 
                        "doSearchRewriteFNs: after compute_rewrite_search filter: %s\n", 
index 3a5d15c399cb9fda0db2d15e0a92deabe78eb1a3..d2223a2ab2afb95ccfcc0cdb679735dbdf14932f 100644 (file)
@@ -35,13 +35,14 @@ BER_MEMCALLOC_FN sl_calloc;
 BER_MEMREALLOC_FN sl_realloc;
 BER_MEMFREE_FN sl_free;
 
-static BerMemoryFunctions sl_bmf =
+
+BerMemoryFunctions sl_mfuncs =
        { sl_malloc, sl_calloc, sl_realloc, sl_free };
 
 void
 sl_mem_init()
 {
-       ber_set_option( NULL, LBER_OPT_MEMORY_FNS, &sl_bmf );
+       ber_set_option( NULL, LBER_OPT_MEMORY_FNS, &sl_mfuncs );
 }
 
 void *
index 22faaff70c5e9e082f7cbb93d1809a87e2e8774e..8ae1b3ad2c592d953bd56a72d372abb567864594 100644 (file)
@@ -1840,8 +1840,11 @@ typedef struct slap_op {
 
        void    *o_threadctx;           /* thread pool thread context */
        void    *o_tmpmemctx;           /* slab malloc context */
-       BER_MEMALLOC_FN *o_tmpalloc;
-       BER_MEMFREE_FN *o_tmpfree;
+       BerMemoryFunctions *o_tmpmfuncs;
+#define        o_tmpalloc      o_tmpmfuncs->bmf_malloc
+#define o_tmpcalloc    o_tmpmfuncs->bmf_calloc
+#define        o_tmprealloc    o_tmpmfuncs->bmf_realloc
+#define        o_tmpfree       o_tmpmfuncs->bmf_free
        void    *o_private;     /* anything the backend needs */
 
        LDAP_STAILQ_ENTRY(slap_op)      o_next; /* next operation in list         */
index 710bd13b10a49e718ed6ad762e7b32009c8f5abf..c4f41060d9cbe2ef5f8c5a61ff0faf164108b81c 100644 (file)
@@ -68,8 +68,7 @@ str2filter( const char *str )
        Operation op = {0};
 
        op.o_tmpmemctx = NULL;
-       op.o_tmpalloc = ch_malloc;
-       op.o_tmpfree = ch_free;
+       op.o_tmpmfuncs = &ch_mfuncs;
 
        return str2filter_x( &op, str );
 }