From: Kurt Zeilenga Date: Tue, 15 Aug 2000 21:57:28 +0000 (+0000) Subject: Move delete of last value check out of inner loop. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2249 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=20248e7430f8a7ab975d18f86260b5a727aa2343;p=openldap Move delete of last value check out of inner loop. --- diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 6d3974cef4..114dbb0c62 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -379,26 +379,17 @@ delete_values( if( rc == LDAP_SUCCESS && match != 0 ) { continue; } + + /* found a matching value */ found = 1; - /* found a matching value - delete it */ + /* delete it */ ber_bvfree( a->a_vals[j] ); for ( k = j + 1; a->a_vals[k] != NULL; k++ ) { a->a_vals[k - 1] = a->a_vals[k]; } a->a_vals[k - 1] = NULL; - /* delete the entire attribute, if no values remain */ - if ( a->a_vals[0] == NULL) { - Debug( LDAP_DEBUG_ARGS, - "removing entire attribute %s\n", - desc, 0, 0 ); - if ( attr_delete( &e->e_attrs, mod->sm_desc ) ) { - ber_bvfree( asserted ); - return LDAP_NO_SUCH_ATTRIBUTE; - } - } - break; } @@ -413,6 +404,16 @@ delete_values( } } + /* if no values remain, delete the entire attribute */ + if ( a->a_vals[0] == NULL ) { + Debug( LDAP_DEBUG_ARGS, + "removing entire attribute %s\n", + desc, 0, 0 ); + if ( attr_delete( &e->e_attrs, mod->sm_desc ) ) { + return LDAP_NO_SUCH_ATTRIBUTE; + } + } + return LDAP_SUCCESS; }