From 88ef2246e86dcca4748b08002411908f7f36c082 Mon Sep 17 00:00:00 2001 From: Rene Pickhardt Date: Thu, 26 Jul 2018 23:17:45 +0200 Subject: [PATCH] exchanged code containing goto with a do while loop (#1758) exchanged code containing goto with a do while loop --- lightningd/watch.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lightningd/watch.c b/lightningd/watch.c index 5402db202..b79d0bb72 100644 --- a/lightningd/watch.c +++ b/lightningd/watch.c @@ -270,19 +270,17 @@ void watch_topology_changed(struct chain_topology *topo) struct txwatch_hash_iter i; struct txwatch *w; bool needs_rerun; - -again: - /* Iterating a htable during deletes is safe, but might skip entries. */ - needs_rerun = false; - for (w = txwatch_hash_first(&topo->txwatches, &i); - w; - w = txwatch_hash_next(&topo->txwatches, &i)) { - u32 depth; - - depth = get_tx_depth(topo, &w->txid); - if (depth) - needs_rerun |= txw_fire(w, &w->txid, depth); - } - if (needs_rerun) - goto again; + do { + /* Iterating a htable during deletes is safe, but might skip entries. */ + needs_rerun = false; + for (w = txwatch_hash_first(&topo->txwatches, &i); + w; + w = txwatch_hash_next(&topo->txwatches, &i)) { + u32 depth; + + depth = get_tx_depth(topo, &w->txid); + if (depth) + needs_rerun |= txw_fire(w, &w->txid, depth); + } + } while (needs_rerun); }