]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/seqmod.c
trim listed modules
[openldap] / servers / slapd / overlays / seqmod.c
index fca24960c5bdf512dbef52f1052161c5d87b31bc..278face56d26e3a7791e934017e4cc9778d8fbba 100644 (file)
@@ -1,7 +1,7 @@
 /* seqmod.c - sequenced modifies */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2004 The OpenLDAP Foundation.
+ * Copyright 2004-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -19,8 +19,6 @@
 
 #include "portable.h"
 
-#define        SLAPD_OVER_SEQMOD       SLAPD_MOD_STATIC
-
 #ifdef SLAPD_OVER_SEQMOD
 
 #include "slap.h"
@@ -54,14 +52,16 @@ sm_avl_cmp( const void *c1, const void *c2 )
 static int
 seqmod_op_cleanup( Operation *op, SlapReply *rs )
 {
-       seqmod_info *sm = op->o_callback->sc_private;
-       modtarget *mt;
+       slap_callback *sc = op->o_callback;
+       seqmod_info *sm = sc->sc_private;
+       modtarget *mt, mtdummy;
        Avlnode  *av;
 
+       mtdummy.mt_op = op;
        /* This op is done, remove it */
        ldap_pvt_thread_mutex_lock( &sm->sm_mutex );
-       av = avl_find( sm->sm_mods, mt, sm_avl_cmp );
-       assert(av);
+       av = avl_find2( sm->sm_mods, &mtdummy, sm_avl_cmp );
+       assert(av != NULL);
 
        mt = av->avl_data;
 
@@ -73,8 +73,8 @@ seqmod_op_cleanup( Operation *op, SlapReply *rs )
                avl_delete( &sm->sm_mods, mt, sm_avl_cmp );
        }
        ldap_pvt_thread_mutex_unlock( &sm->sm_mutex );
-       op->o_callback = op->o_callback->sc_next;
-       op->o_tmpfree( op->o_callback, op->o_tmpmemctx );
+       op->o_callback = sc->sc_next;
+       op->o_tmpfree( sc, op->o_tmpmemctx );
 
        return 0;
 }
@@ -99,7 +99,7 @@ seqmod_op_mod( Operation *op, SlapReply *rs )
         * near-simultaneous mods of the same entry
         */
        ldap_pvt_thread_mutex_lock( &sm->sm_mutex );
-       av = avl_find( sm->sm_mods, mt, sm_avl_cmp );
+       av = avl_find2( sm->sm_mods, mt, sm_avl_cmp );
        if ( av ) {
                modtarget *mtp = av->avl_data;
                mtp->mt_tail->mt_next = mt;
@@ -178,7 +178,7 @@ seqmod_db_close(
 static slap_overinst           seqmod;
 
 int
-seqmod_init()
+seqmod_initialize()
 {
        seqmod.on_bi.bi_type = "seqmod";
        seqmod.on_bi.bi_db_open = seqmod_db_open;
@@ -195,7 +195,7 @@ seqmod_init()
 int
 init_module( int argc, char *argv[] )
 {
-       return seqmod_init();
+       return seqmod_initialize();
 }
 #endif /* SLAPD_OVER_SEQMOD == SLAPD_MOD_DYNAMIC */