]> git.sur5r.net Git - openldap/commitdiff
Move delete of last value check out of inner loop.
authorKurt Zeilenga <kurt@openldap.org>
Tue, 15 Aug 2000 21:57:28 +0000 (21:57 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 15 Aug 2000 21:57:28 +0000 (21:57 +0000)
servers/slapd/back-ldbm/modify.c

index 6d3974cef49817218e81ee9a759c2fdba3b0a9ae..114dbb0c626f849137d27100f2097a70b19e60ef 100644 (file)
@@ -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;
 }