summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-06-22 11:42:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:32 -0500
commit3618a077085f9384eac901e26524bb474ed0a679 (patch)
tree8083fda567e470edcfa45d947ed2bd1a47e99557
parent394291281a0be7a150086fc459614f4fe3f56c1f (diff)
downloadsamba-3618a077085f9384eac901e26524bb474ed0a679.tar.gz
samba-3618a077085f9384eac901e26524bb474ed0a679.tar.bz2
samba-3618a077085f9384eac901e26524bb474ed0a679.zip
r23584: Use a while loop instead of a for loop without increment... :-)
Michael (This used to be commit fb4ade3b4d203eead7798b8d98938cff2abb9c29)
-rw-r--r--source3/registry/reg_api.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c
index e2bb56deea..9147becf9b 100644
--- a/source3/registry/reg_api.c
+++ b/source3/registry/reg_api.c
@@ -691,7 +691,6 @@ WERROR reg_deletekey_recursive(TALLOC_CTX *ctx,
TALLOC_CTX *mem_ctx = NULL;
WERROR werr = WERR_OK;
struct registry_key *key;
- uint32 idx = 0;
char *subkey_name = NULL;
mem_ctx = talloc_new(ctx);
@@ -706,14 +705,8 @@ WERROR reg_deletekey_recursive(TALLOC_CTX *ctx,
goto done;
}
- /* NOTE: we *must not* increment idx in this loop since
- * the list of subkeys shrinks with each loop body.
- * so this way, we repeatedly delete the *first* entry
- * of a shrinking list. */
- for (idx = 0;
- W_ERROR_IS_OK(werr = reg_enumkey(mem_ctx, key, idx,
- &subkey_name, NULL));
- )
+ while (W_ERROR_IS_OK(werr = reg_enumkey(mem_ctx, key, 0,
+ &subkey_name, NULL)))
{
werr = reg_deletekey_recursive(mem_ctx, key, subkey_name);
if (!W_ERROR_IS_OK(werr)) {