Use foreach_set() instead of reimplementing it.
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 13 Jul 2012 05:56:30 +0000 (07:56 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 13 Jul 2012 21:03:55 +0000 (23:03 +0200)
ir/be/becopyheur.c
ir/be/becopyopt_t.h
ir/tr/tr_inheritance.c

index 627810f..bd769bb 100644 (file)
@@ -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));
index ec61973..b5bf032 100644 (file)
@@ -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 */
index 16edd40..6bdcb44 100644 (file)
@@ -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]);
                }