[Libosinfo] [libosinfo PATCH] test-os: Fix test breakage

Fabiano Fidêncio fidencio at redhat.com
Mon Nov 19 09:30:40 UTC 2018


"for" loop initial declarations are only allowed in C99 mode but some
old compilers (like the ones in centos7 or debian8) just don't use it by
default.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 tests/test-os.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/test-os.c b/tests/test-os.c
index f1cbf96..ae66202 100644
--- a/tests/test-os.c
+++ b/tests/test-os.c
@@ -242,6 +242,7 @@ compare_resources(OsinfoOs *os,
                   OsinfoList *resourceslist2)
 {
     GList *list1, *list2;
+    GList *it1, *it2;
 
     list1 = osinfo_list_get_elements(resourceslist1);
     list2 = osinfo_list_get_elements(resourceslist2);
@@ -249,13 +250,13 @@ compare_resources(OsinfoOs *os,
     if (list1 == NULL || list2 == NULL)
         return;
 
-    for (GList *it1 = list1; it1 != NULL; it1 = it1->next) {
+    for (it1 = list1; it1 != NULL; it1 = it1->next) {
         OsinfoResources *resources1 = it1->data;
         const gchar *arch1;
 
         arch1 = osinfo_resources_get_architecture(resources1);
 
-        for (GList *it2 = list2; it2 != NULL; it2 = it2->next) {
+        for (it2 = list2; it2 != NULL; it2 = it2->next) {
             OsinfoResources *resources2 = it2->data;
             const gchar *arch2 = osinfo_resources_get_architecture(resources2);
 
-- 
2.19.1




More information about the Libosinfo mailing list