[libvirt] [PATCH 17/17] avoid compiler warning when all storage backends are disabled

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

 



From: Jim Meyering <meyering@xxxxxxxxxx>

* src/storage_backend.c (backends): Add a NULL terminator.
(virStorageBackendForType): Use NULL terminator rather than
warning-provoking (possibly 0) array size.
---
 src/storage_backend.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/storage_backend.c b/src/storage_backend.c
index e33f98c..1f4ed10 100644
--- a/src/storage_backend.c
+++ b/src/storage_backend.c
@@ -82,13 +82,14 @@ static virStorageBackendPtr backends[] = {
 #if WITH_STORAGE_DISK
     &virStorageBackendDisk,
 #endif
+    NULL
 };


 virStorageBackendPtr
 virStorageBackendForType(int type) {
     unsigned int i;
-    for (i = 0 ; i < ARRAY_CARDINALITY(backends); i++)
+    for (i = 0; backends[i]; i++)
         if (backends[i]->type == type)
             return backends[i];

-- 
1.6.0.3.756.gb776d

--
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]