From: Juan Gomez Date: Tue, 15 Jun 1999 20:06:16 +0000 (+0000) Subject: Enabled deletion of stale index entries. (EXPERIMENTAL) X-Git-Tag: OPENLDAP_REL_ENG_2_BP~302 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5b0e434d935421581a208e58bbe25da30dba181f;p=openldap Enabled deletion of stale index entries. (EXPERIMENTAL) --- diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index c7bc9c1135..b27327dccb 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -193,7 +193,54 @@ delete_value( ) { - return 0; + int rc; + Datum key; + /* XXX do we need idl ??? */ + ID_BLOCK *idl = NULL; + char *tmpval = NULL; + char *realval = val; + char buf[BUFSIZ]; + + char prefix = index2prefix( indextype ); + + ldbm_datum_init( key ); + + Debug( LDAP_DEBUG_TRACE, + "=> delete_value( \"%c%s\" )\n", + prefix, val, 0 ); + + if ( prefix != UNKNOWN_PREFIX ) { + unsigned int len = strlen( val ); + + if ( (len + 2) < sizeof(buf) ) { + realval = buf; + } else { + /* value + prefix + null */ + tmpval = (char *) ch_malloc( len + 2 ); + realval = tmpval; + } + realval[0] = prefix; + strcpy( &realval[1], val ); + } + + key.dptr = realval; + key.dsize = strlen( realval ) + 1; + + rc = idl_delete_key( be, db, key, id ); + + if ( tmpval != NULL ) { + free( tmpval ); + } + + if( idl != NULL ) { + idl_free( idl ); + } + + ldap_pvt_thread_yield(); + + Debug( LDAP_DEBUG_TRACE, "<= delete_value %d\n", rc, 0, 0 ); + + return( rc ); }/* static int delete_value() */