]> git.sur5r.net Git - openldap/commitdiff
Fix pblock_delete_param(), this function never worked
authorLuke Howard <lukeh@openldap.org>
Mon, 25 Jul 2005 05:38:31 +0000 (05:38 +0000)
committerLuke Howard <lukeh@openldap.org>
Mon, 25 Jul 2005 05:38:31 +0000 (05:38 +0000)
servers/slapd/slapi/slapi.h
servers/slapd/slapi/slapi_pblock.c

index fb0ed0f84cff217dd7425250c36f1e7d44e02da9..83f40a588f5014074330a2c04313372caa19acb4 100644 (file)
@@ -108,7 +108,6 @@ typedef enum slapi_pblock_class_e {
 
 struct slapi_pblock {
        ldap_pvt_thread_mutex_t pblockMutex;
-       int                     ckParams;
        int                     numParams;
        int                     curParams[PBLOCK_MAX_PARAMS];
        void                    *curVals[PBLOCK_MAX_PARAMS];
index 776593d9c2cc1dcca6cd14ec0bfb2a15128cee5d..bd5811442ac3c70cd184d2aea3809d38ab3f031f 100644 (file)
@@ -1147,9 +1147,11 @@ pblock_delete_param( Slapi_PBlock *p, int param )
                pblock_unlock( p );
                return PBLOCK_ERROR;
        }
+
+       /* move last parameter to index of deleted parameter */
        if ( p->numParams > 1 ) {
-               p->curParams[i] = p->curParams[p->numParams];
-               p->curVals[i] = p->curVals[p->numParams];
+               p->curParams[i] = p->curParams[p->numParams - 1];
+               p->curVals[i] = p->curVals[p->numParams - 1];
        }
        p->numParams--;
 
@@ -1165,7 +1167,6 @@ slapi_pblock_new(void)
 
        pb = (Slapi_PBlock *) ch_calloc( 1, sizeof(Slapi_PBlock) );
        if ( pb != NULL ) {
-               pb->ckParams = 1;
                ldap_pvt_thread_mutex_init( &pb->pblockMutex );
                memset( pb->curParams, 0, sizeof(pb->curParams) );
                memset( pb->curVals, 0, sizeof(pb->curVals) );