From c6571686bfbfb3c87ae24ae1dc568e685d6cd49a Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Fri, 13 Jul 2012 07:56:30 +0200 Subject: [PATCH] Use foreach_set() instead of reimplementing it. --- ir/be/becopyheur.c | 3 +-- ir/be/becopyopt_t.h | 5 +---- ir/tr/tr_inheritance.c | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/ir/be/becopyheur.c b/ir/be/becopyheur.c index 627810f01..bd769bb2f 100644 --- a/ir/be/becopyheur.c +++ b/ir/be/becopyheur.c @@ -621,8 +621,7 @@ static void ou_optimize(unit_t *ou) } /* set color of all changed nodes */ - for (ns = (node_stat_t*)set_first(curr->changed_nodes); ns != NULL; - ns = (node_stat_t*)set_next(curr->changed_nodes)) { + foreach_set(curr->changed_nodes, node_stat_t, ns) { /* NO_COLOR is possible, if we had an undo */ if (ns->new_color != NO_COLOR) { DBG((dbg, LEVEL_1, "\t color(%+F) := %d\n", ns->irn, ns->new_color)); diff --git a/ir/be/becopyopt_t.h b/ir/be/becopyopt_t.h index ec61973f1..b5bf03228 100644 --- a/ir/be/becopyopt_t.h +++ b/ir/be/becopyopt_t.h @@ -149,10 +149,7 @@ static inline affinity_node_t *get_affinity_info(const copy_opt_t *co, const ir_ return (affinity_node_t*)set_find(co->nodes, &find, sizeof(find), hash_irn(irn)); } -#define co_gs_nodes_begin(co) set_first((co)->nodes) -#define co_gs_nodes_next(co) set_next((co)->nodes) - -#define co_gs_foreach_aff_node(co, aff_node) for (aff_node = (affinity_node_t*)co_gs_nodes_begin(co); aff_node != NULL; aff_node = (affinity_node_t*)co_gs_nodes_next(co)) +#define co_gs_foreach_aff_node(co, aff_node) foreach_set((co)->nodes, affinity_node_t, (aff_node)) #define co_gs_foreach_neighb(aff_node, neighb) for (neighb = aff_node->neighbours; neighb != NULL; neighb = neighb->next) #endif /* FIRM_BE_BECOPYOPT_T_H */ diff --git a/ir/tr/tr_inheritance.c b/ir/tr/tr_inheritance.c index 16edd405b..6bdcb44de 100644 --- a/ir/tr/tr_inheritance.c +++ b/ir/tr/tr_inheritance.c @@ -397,8 +397,7 @@ void free_inh_transitive_closure(void) { if (tr_inh_trans_set) { tr_inh_trans_tp *elt; - for (elt = (tr_inh_trans_tp*)set_first(tr_inh_trans_set); elt != NULL; - elt = (tr_inh_trans_tp*)set_next(tr_inh_trans_set)) { + foreach_set(tr_inh_trans_set, tr_inh_trans_tp, elt) { del_pset(elt->directions[d_up]); del_pset(elt->directions[d_down]); } -- 2.20.1