From bb04c4eb9dad100f7d23340be7ec5c9211b44bf0 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Mon, 25 Jul 2005 05:38:31 +0000 Subject: [PATCH] Fix pblock_delete_param(), this function never worked --- servers/slapd/slapi/slapi.h | 1 - servers/slapd/slapi/slapi_pblock.c | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/servers/slapd/slapi/slapi.h b/servers/slapd/slapi/slapi.h index fb0ed0f84c..83f40a588f 100644 --- a/servers/slapd/slapi/slapi.h +++ b/servers/slapd/slapi/slapi.h @@ -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]; diff --git a/servers/slapd/slapi/slapi_pblock.c b/servers/slapd/slapi/slapi_pblock.c index 776593d9c2..bd5811442a 100644 --- a/servers/slapd/slapi/slapi_pblock.c +++ b/servers/slapd/slapi/slapi_pblock.c @@ -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) ); -- 2.39.5