[Ovirt-devel] [PATCH] avoid warnings from gcc -Wshadow

Jim Meyering jim at meyering.net
Mon Sep 8 12:38:27 UTC 2008


I usually build with gcc's -Wshadow option.
That triggered some warnings, and since the changes are tiny,
I fixed the code to avoid the warnings.

>From d95342b0df5ba6af0315fbf8dd7b77abf04ccae8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 8 Sep 2008 10:05:48 +0200
Subject: [PATCH] avoid warnings from gcc -Wshadow

* gather.c (get_nic_info): Avoid shadowing "index".
* gather.c (get_nic_data): Avoid shadowing global "nic_info".
---
 ovirt-identify-node/gather.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ovirt-identify-node/gather.c b/ovirt-identify-node/gather.c
index 06b213e..4a664f7 100644
--- a/ovirt-identify-node/gather.c
+++ b/ovirt-identify-node/gather.c
@@ -192,7 +192,7 @@ create_nic_info(void)
 /* Determines the speed of the network interface.
  */
 void
-get_nic_data(char *nic, nic_info_ptr nic_info)
+get_nic_data(char *nic, nic_info_ptr nic_info_p)
 {
     char *interface;

@@ -233,7 +233,7 @@ get_nic_data(char *nic, nic_info_ptr nic_info)
                                    SUPPORTED_10baseT_Full))
             bandwidth = 10;

-        snprintf(nic_info->bandwidth, BUFFER_LENGTH, "%d", bandwidth);
+        snprintf(nic_info_p->bandwidth, BUFFER_LENGTH, "%d", bandwidth);
     }
 }

@@ -250,15 +250,15 @@ get_nic_info(void)

     int num_results;

-    int index;
+    int i;

     nics = libhal_find_device_by_capability(hal_ctx, "net",
                                             &num_results, &dbus_error);

     DEBUG("Found %d NICs\n", num_results);

-    for (index = 0; index < num_results; index++) {
-        char *nic = nics[index];
+    for (i = 0; i < num_results; i++) {
+        char *nic = nics[i];

         VERBOSE("Starting new NIC.\n");

--
1.6.0.1.196.g01914




More information about the ovirt-devel mailing list