diff options
author | Daniele Di Proietto <diproiettod@vmware.com> | 2016-04-06 18:53:59 -0700 |
---|---|---|
committer | Daniele Di Proietto <diproiettod@vmware.com> | 2016-04-26 23:28:59 -0700 |
commit | 4ec3d7c7578e827a543cc0989a6cd4c1a10ee291 (patch) | |
tree | 8d0960b44448bf6a84a4ad3e609af26685277a4f /ofproto/bond.c | |
parent | e0b9270136465f1c5379c274ca41081980bcd076 (diff) | |
download | openvswitch-4ec3d7c7578e827a543cc0989a6cd4c1a10ee291.tar.gz |
hmap: Add HMAP_FOR_EACH_POP.
Makes popping each member of the hmap a bit easier.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto/bond.c')
-rw-r--r-- | ofproto/bond.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ofproto/bond.c b/ofproto/bond.c index 0dbd0d270..032b8f61d 100644 --- a/ofproto/bond.c +++ b/ofproto/bond.c @@ -257,8 +257,8 @@ bond_ref(const struct bond *bond_) void bond_unref(struct bond *bond) { - struct bond_slave *slave, *next_slave; - struct bond_pr_rule_op *pr_op, *next_op; + struct bond_pr_rule_op *pr_op; + struct bond_slave *slave; if (!bond || ovs_refcount_unref_relaxed(&bond->ref_cnt) != 1) { return; @@ -268,8 +268,7 @@ bond_unref(struct bond *bond) hmap_remove(all_bonds, &bond->hmap_node); ovs_rwlock_unlock(&rwlock); - HMAP_FOR_EACH_SAFE (slave, next_slave, hmap_node, &bond->slaves) { - hmap_remove(&bond->slaves, &slave->hmap_node); + HMAP_FOR_EACH_POP (slave, hmap_node, &bond->slaves) { /* Client owns 'slave->netdev'. */ free(slave->name); free(slave); @@ -280,8 +279,7 @@ bond_unref(struct bond *bond) free(bond->hash); free(bond->name); - HMAP_FOR_EACH_SAFE(pr_op, next_op, hmap_node, &bond->pr_rule_ops) { - hmap_remove(&bond->pr_rule_ops, &pr_op->hmap_node); + HMAP_FOR_EACH_POP (pr_op, hmap_node, &bond->pr_rule_ops) { free(pr_op); } hmap_destroy(&bond->pr_rule_ops); |