[PATCH 04/24] tests: hostdev: Use size_t for count variables

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

 



virPCIDeviceListCount()'s return type is size_t, so variables that
store its return value should be of that type.
---
 tests/virhostdevtest.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 77b119b..c1321b1 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -39,10 +39,10 @@ VIR_LOG_INIT("tests.hostdevtest");
 
 # define CHECK_LIST_COUNT(list, cnt)                                        \
     do {                                                                    \
-        int count;                                                          \
+        size_t count;                                                       \
         if ((count = virPCIDeviceListCount(list)) != cnt) {                 \
             virReportError(VIR_ERR_INTERNAL_ERROR,                          \
-                           "Unexpected count of items in " #list ": %d, "   \
+                           "Unexpected count of items in " #list ": %zu, "  \
                            "expecting %zu", count, (size_t) cnt);           \
             goto cleanup;                                                   \
         }                                                                   \
@@ -163,8 +163,7 @@ static int
 testVirHostdevPreparePCIHostdevs_unmanaged(const void *opaque ATTRIBUTE_UNUSED)
 {
     int ret = -1;
-    size_t i;
-    int active_count, inactive_count;
+    size_t active_count, inactive_count, i;
 
     for (i = 0; i < nhostdevs; i++)
          hostdevs[i]->managed = false;
@@ -222,8 +221,7 @@ static int
 testVirHostdevReAttachPCIHostdevs_unmanaged(const void *opaque ATTRIBUTE_UNUSED)
 {
     int ret = -1;
-    size_t i;
-    int active_count, inactive_count;
+    size_t active_count, inactive_count, i;
 
     for (i = 0; i < nhostdevs; i++) {
         if (hostdevs[i]->managed != false) {
@@ -256,8 +254,7 @@ static int
 testVirHostdevPreparePCIHostdevs_managed(const void *opaque ATTRIBUTE_UNUSED)
 {
     int ret = -1;
-    size_t i;
-    int active_count;
+    size_t active_count, i;
 
     for (i = 0; i < nhostdevs; i++)
         hostdevs[i]->managed = true;
@@ -302,8 +299,7 @@ static int
 testVirHostdevReAttachPCIHostdevs_managed(const void *opaque ATTRIBUTE_UNUSED)
 {
     int ret = -1;
-    size_t i;
-    int active_count;
+    size_t active_count, i;
 
     for (i = 0; i < nhostdevs; i++) {
         if (hostdevs[i]->managed != true) {
@@ -334,8 +330,7 @@ static int
 testVirHostdevDetachPCINodeDevice(const void *opaque ATTRIBUTE_UNUSED)
 {
     int ret = -1;
-    size_t i;
-    int inactive_count;
+    size_t inactive_count, i;
 
     for (i = 0; i < nhostdevs; i++) {
         inactive_count = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
@@ -371,8 +366,7 @@ static int
 testVirHostdevReAttachPCINodeDevice(const void *opaque ATTRIBUTE_UNUSED)
 {
     int ret = -1;
-    size_t i;
-    int inactive_count;
+    size_t inactive_count, i;
 
     for (i = 0; i < nhostdevs; i++) {
         inactive_count = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
@@ -392,7 +386,7 @@ static int
 testVirHostdevUpdateActivePCIHostdevs(const void *opaque ATTRIBUTE_UNUSED)
 {
     int ret = -1;
-    int active_count;
+    size_t active_count;
 
     active_count = virPCIDeviceListCount(mgr->activePCIHostdevs);
 
-- 
2.5.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]