summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorAdrian Moreno <amorenoz@redhat.com>2022-03-23 12:56:14 +0100
committerIlya Maximets <i.maximets@ovn.org>2022-03-30 16:59:02 +0200
commite9bf5bffb020e3dca4104118e15c69242bc12e33 (patch)
tree01e35216faf311d3313c6f20464dc884c2dc1f81 /utilities
parentd4566085edf50033087652f35f92b9b77cbec70f (diff)
downloadopenvswitch-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 'utilities')
-rw-r--r--utilities/ovs-ofctl.c4
-rw-r--r--utilities/ovs-vsctl.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index ede7f1e61..6771973ae 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -730,12 +730,12 @@ static void
bundle_print_errors(struct ovs_list *errors, struct ovs_list *requests,
const char *vconn_name)
{
- struct ofpbuf *error, *next;
+ struct ofpbuf *error;
struct ofpbuf *bmsg;
INIT_CONTAINER(bmsg, requests, list_node);
- LIST_FOR_EACH_SAFE (error, next, list_node, errors) {
+ LIST_FOR_EACH_SAFE (error, list_node, errors) {
const struct ofp_header *error_oh = error->data;
ovs_be32 error_xid = error_oh->xid;
enum ofperr ofperr;
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 37cc72d40..812455eea 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -1510,13 +1510,13 @@ cmd_add_br(struct ctl_context *ctx)
static void
del_port(struct vsctl_context *vsctl_ctx, struct vsctl_port *port)
{
- struct vsctl_iface *iface, *next_iface;
+ struct vsctl_iface *iface;
bridge_delete_port((port->bridge->parent
? port->bridge->parent->br_cfg
: port->bridge->br_cfg), port->port_cfg);
- LIST_FOR_EACH_SAFE (iface, next_iface, ifaces_node, &port->ifaces) {
+ LIST_FOR_EACH_SAFE (iface, ifaces_node, &port->ifaces) {
del_cached_iface(vsctl_ctx, iface);
}
del_cached_port(vsctl_ctx, port);
@@ -1526,14 +1526,14 @@ static void
del_bridge(struct vsctl_context *vsctl_ctx, struct vsctl_bridge *br)
{
struct vsctl_bridge *child, *next_child;
- struct vsctl_port *port, *next_port;
+ struct vsctl_port *port;
const struct ovsrec_flow_sample_collector_set *fscset, *next_fscset;
HMAP_FOR_EACH_SAFE (child, next_child, children_node, &br->children) {
del_bridge(vsctl_ctx, child);
}
- LIST_FOR_EACH_SAFE (port, next_port, ports_node, &br->ports) {
+ LIST_FOR_EACH_SAFE (port, ports_node, &br->ports) {
del_port(vsctl_ctx, port);
}