[ovs-dev] [PATCH 2/3] dpctl: Fix shadowed iterator in show_dpif().
Justin Pettit
jpettit at ovn.org
Tue Jul 12 19:19:21 UTC 2016
Signed-off-by: Justin Pettit <jpettit at ovn.org>
---
lib/dpctl.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/dpctl.c b/lib/dpctl.c
index b870e30..003602a 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -577,13 +577,10 @@ show_dpif(struct dpif *dpif, struct dpctl_params *dpctl_p)
smap_init(&config);
error = netdev_get_config(netdev, &config);
if (!error) {
- const struct smap_node **nodes;
- size_t i;
-
- nodes = smap_sort(&config);
- for (i = 0; i < smap_count(&config); i++) {
- const struct smap_node *node = nodes[i];
- dpctl_print(dpctl_p, "%c %s=%s", i ? ',' : ':',
+ const struct smap_node **nodes = smap_sort(&config);
+ for (size_t j = 0; j < smap_count(&config); j++) {
+ const struct smap_node *node = nodes[j];
+ dpctl_print(dpctl_p, "%c %s=%s", j ? ',' : ':',
node->key, node->value);
}
free(nodes);
--
1.9.1
More information about the dev
mailing list