diff mbox

[ovs-dev,3/3] ovsdb-client: Move iterator definition to prevent shadowing.

Message ID 1468351162-349-3-git-send-email-jpettit@ovn.org
State Accepted
Headers show

Commit Message

Justin Pettit July 12, 2016, 7:19 p.m. UTC
This doesn't fix a bug, but is more standard.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
---
 ovsdb/ovsdb-client.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Daniele Di Proietto July 13, 2016, 6:57 a.m. UTC | #1
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>

I see that there are a bunch of similar problems in the tree.

Should we fix those? I started working on a series, though a lot of
creative naming is required

Should we enable -Wshadow in configure.ac?

Thanks,

Daniele


2016-07-12 12:19 GMT-07:00 Justin Pettit <jpettit@ovn.org>:

> This doesn't fix a bug, but is more standard.
>
> Signed-off-by: Justin Pettit <jpettit@ovn.org>
> ---
>  ovsdb/ovsdb-client.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
> index 80819a8..25fe903 100644
> --- a/ovsdb/ovsdb-client.c
> +++ b/ovsdb/ovsdb-client.c
> @@ -655,7 +655,6 @@ monitor2_print_table(struct json *table_update2,
>      const struct ovsdb_column_set *columns = &mt->columns;
>      struct shash_node *node;
>      struct table t;
> -    size_t i;
>
>      if (table_update2->type != JSON_OBJECT) {
>          ovs_error(0, "<table-update> for table %s is not object",
> table->name);
> @@ -668,7 +667,7 @@ monitor2_print_table(struct json *table_update2,
>
>      table_add_column(&t, "row");
>      table_add_column(&t, "action");
> -    for (i = 0; i < columns->n_columns; i++) {
> +    for (size_t i = 0; i < columns->n_columns; i++) {
>          table_add_column(&t, "%s", columns->columns[i]->name);
>      }
>      SHASH_FOR_EACH (node, json_object(table_update2)) {
> --
> 1.9.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
Justin Pettit July 13, 2016, 7:22 a.m. UTC | #2
> On Jul 12, 2016, at 11:57 PM, Daniele Di Proietto <diproiettod@ovn.org> wrote:
> 
> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
> 
> I see that there are a bunch of similar problems in the tree.
> 
> Should we fix those? I started working on a series, though a lot of creative naming is required
> 
> Should we enable -Wshadow in configure.ac?

Yeah, this effort started off that way, but, as you noticed, it becomes a bigger project.  I didn't want to take that on today, so I just wanted to quickly fix the ones that actually looked like problems.  I think it would be great if we could get OVS to build with -Wshadow.  If no one beats me to it, I may make another stab at it when I get more time, but clearly no one should be blocking on me these days.  :-(

Thanks for the quick reviews.  I'll push the series in a minute.

--Justin
diff mbox

Patch

diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index 80819a8..25fe903 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -655,7 +655,6 @@  monitor2_print_table(struct json *table_update2,
     const struct ovsdb_column_set *columns = &mt->columns;
     struct shash_node *node;
     struct table t;
-    size_t i;
 
     if (table_update2->type != JSON_OBJECT) {
         ovs_error(0, "<table-update> for table %s is not object", table->name);
@@ -668,7 +667,7 @@  monitor2_print_table(struct json *table_update2,
 
     table_add_column(&t, "row");
     table_add_column(&t, "action");
-    for (i = 0; i < columns->n_columns; i++) {
+    for (size_t i = 0; i < columns->n_columns; i++) {
         table_add_column(&t, "%s", columns->columns[i]->name);
     }
     SHASH_FOR_EACH (node, json_object(table_update2)) {