diff options
author | Adrian Moreno <amorenoz@redhat.com> | 2022-03-23 12:56:14 +0100 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-03-30 16:59:02 +0200 |
commit | e9bf5bffb020e3dca4104118e15c69242bc12e33 (patch) | |
tree | 01e35216faf311d3313c6f20464dc884c2dc1f81 /vswitchd | |
parent | d4566085edf50033087652f35f92b9b77cbec70f (diff) | |
download | openvswitch-e9bf5bffb020e3dca4104118e15c69242bc12e33.tar.gz |
list: use short version of safe loops if possible.
Using the SHORT version of the *_SAFE loops makes the code cleaner
and less error-prone. So, use the SHORT version and remove the extra
variable when possible.
In order to be able to use both long and short versions without changing
the name of the macro for all the clients, overload the existing name
and select the appropriate version depending on the number of arguments.
Acked-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'vswitchd')
-rw-r--r-- | vswitchd/bridge.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 5223aa897..b1bc51bd5 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1133,9 +1133,9 @@ bridge_delete_or_reconfigure_ports(struct bridge *br) * whose module was just unloaded via "rmmod", or a virtual NIC for a * VM whose VM was just terminated. */ HMAP_FOR_EACH_SAFE (port, port_next, hmap_node, &br->ports) { - struct iface *iface, *iface_next; + struct iface *iface; - LIST_FOR_EACH_SAFE (iface, iface_next, port_elem, &port->ifaces) { + LIST_FOR_EACH_SAFE (iface, port_elem, &port->ifaces) { if (!sset_contains(&ofproto_ports, iface->name)) { iface_destroy__(iface); } @@ -4341,12 +4341,12 @@ static void bridge_aa_refresh_queued(struct bridge *br) { struct ovs_list *list = xmalloc(sizeof *list); - struct bridge_aa_vlan *node, *next; + struct bridge_aa_vlan *node; ovs_list_init(list); ofproto_aa_vlan_get_queued(br->ofproto, list); - LIST_FOR_EACH_SAFE (node, next, list_node, list) { + LIST_FOR_EACH_SAFE (node, list_node, list) { struct port *port; VLOG_INFO("ifname=%s, vlan=%u, oper=%u", node->port_name, node->vlan, @@ -4387,7 +4387,7 @@ port_create(struct bridge *br, const struct ovsrec_port *cfg) static void port_del_ifaces(struct port *port) { - struct iface *iface, *next; + struct iface *iface; struct sset new_ifaces; size_t i; @@ -4398,7 +4398,7 @@ port_del_ifaces(struct port *port) } /* Get rid of deleted interfaces. */ - LIST_FOR_EACH_SAFE (iface, next, port_elem, &port->ifaces) { + LIST_FOR_EACH_SAFE (iface, port_elem, &port->ifaces) { if (!sset_contains(&new_ifaces, iface->name)) { iface_destroy(iface); } @@ -4412,13 +4412,13 @@ port_destroy(struct port *port) { if (port) { struct bridge *br = port->bridge; - struct iface *iface, *next; + struct iface *iface; if (br->ofproto) { ofproto_bundle_unregister(br->ofproto, port); } - LIST_FOR_EACH_SAFE (iface, next, port_elem, &port->ifaces) { + LIST_FOR_EACH_SAFE (iface, port_elem, &port->ifaces) { iface_destroy__(iface); } |