From 3618a077085f9384eac901e26524bb474ed0a679 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Jun 2007 11:42:17 +0000 Subject: r23584: Use a while loop instead of a for loop without increment... :-) Michael (This used to be commit fb4ade3b4d203eead7798b8d98938cff2abb9c29) --- source3/registry/reg_api.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'source3/registry/reg_api.c') 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)) { -- cgit