[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH 03/11] avoid gcc warnings



From: Jim Meyering <meyering redhat com>

* src/osi_os.c: Avoid warnings:
declaration of 'index' shadows a global declaration: s/index/idx/
unused variable 'cursor'
unused variable 'i'
* src/osi_device.c (osi_get_device_by_index): s/index/idx/
---
 src/osi_device.c |    6 +++---
 src/osi_os.c     |    8 +++-----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/osi_device.c b/src/osi_device.c
index 4467057..238ed85 100644
--- a/src/osi_device.c
+++ b/src/osi_device.c
@@ -350,7 +350,7 @@ static osi_device_t wrapped_dev(struct osi_internal_dev * dev, int* err)
     return dev_container;
 }

-osi_device_t osi_get_device_by_index(osi_device_list_t list, int index, int* err)
+osi_device_t osi_get_device_by_index(osi_device_list_t list, int idx, int* err)
 {
     struct osi_dev_list * dev_list;
     struct osi_internal_dev * dev;
@@ -366,12 +366,12 @@ osi_device_t osi_get_device_by_index(osi_device_list_t list, int index, int* err
     dev_list = list->backing_object;

     /* Check bounds */
-    if (index < 0 || index >= dev_list->length) {
+    if (idx < 0 || idx >= dev_list->length) {
         *err = -EINVAL;
         return NULL;
     }

-    dev = dev_list->dev_refs[index];
+    dev = dev_list->dev_refs[idx];
     return wrapped_dev(dev, err);
 }

diff --git a/src/osi_os.c b/src/osi_os.c
index 5511751..03a80c0 100644
--- a/src/osi_os.c
+++ b/src/osi_os.c
@@ -338,7 +338,6 @@ static int os_participates_in_relationship(struct osi_internal_os * os,
                                            osi_relationship relationship)
 {
     struct osi_os_link * os_link;
-    struct list_head * cursor;

     list_for_each_entry(os_link, &os->relationships_list, list)
         if (os_link->verb == relationship)
@@ -531,7 +530,7 @@ int osi_os_list_length(osi_os_list_t list)
     return os_list->length;
 }

-osi_os_t osi_get_os_by_index(osi_os_list_t list, int index, int* err)
+osi_os_t osi_get_os_by_index(osi_os_list_t list, int idx, int* err)
 {
     struct osi_os_list * os_list;
     struct osi_internal_os * os;
@@ -547,12 +546,12 @@ osi_os_t osi_get_os_by_index(osi_os_list_t list, int index, int* err)
     os_list = list->backing_object;

     /* Check bounds */
-    if (index < 0 || index >= os_list->length) {
+    if (idx < 0 || idx >= os_list->length) {
         *err = -EINVAL;
         return NULL;
     }

-    os = os_list->os_refs[index];
+    os = os_list->os_refs[idx];
     return wrapped_os(os, err);
 }

@@ -676,7 +675,6 @@ char** osi_get_os_property_all_values(osi_os_t os, char* propname, int* num, int

 char* osi_get_os_property_first_value(osi_os_t os, char* propname, int* err)
 {
-    int i;
     char* value;
     struct osi_internal_os * internal_os;
     struct osi_keyval_multi * kv, * test_kv;
-- 
1.7.0.rc0.187.g226c


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]