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

[libvirt] [PATCH 10/20] Fix data types used for list sizes in QEMU capabilities



From: "Daniel P. Berrange" <berrange redhat com>

The QEMU capabilities APIs used a misc of 'int' and
'unsigned int' for variables relating to array sizes.
Change all these to use 'size_t'

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 src/qemu/qemu_capabilities.c | 22 +++++++++++-----------
 src/qemu/qemu_capabilities.h |  4 ++--
 src/qemu/qemu_command.c      |  2 +-
 src/qemu/qemu_driver.c       |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index bc45c52..97aeac7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -291,7 +291,7 @@ qemuCapsProbeCommand(const char *qemu,
 static int
 qemuCapsParseMachineTypesStr(const char *output,
                              virCapsGuestMachinePtr **machines,
-                             int *nmachines)
+                             size_t *nmachines)
 {
     const char *p = output;
     const char *next;
@@ -360,7 +360,7 @@ int
 qemuCapsProbeMachineTypes(const char *binary,
                           qemuCapsPtr caps,
                           virCapsGuestMachinePtr **machines,
-                          int *nmachines)
+                          size_t *nmachines)
 {
     char *output;
     int ret = -1;
@@ -401,7 +401,7 @@ qemuCapsGetOldMachinesFromInfo(virCapsGuestDomainInfoPtr info,
                                const char *emulator,
                                time_t emulator_mtime,
                                virCapsGuestMachinePtr **machines,
-                               int *nmachines)
+                               size_t *nmachines)
 {
     virCapsGuestMachinePtr *list;
     int i;
@@ -456,7 +456,7 @@ qemuCapsGetOldMachines(const char *ostype,
                        time_t emulator_mtime,
                        virCapsPtr old_caps,
                        virCapsGuestMachinePtr **machines,
-                       int *nmachines)
+                       size_t *nmachines)
 {
     int i;
 
@@ -490,8 +490,8 @@ qemuCapsGetOldMachines(const char *ostype,
 
 typedef int
 (*qemuCapsParseCPUModels)(const char *output,
-                       unsigned int *retcount,
-                       const char ***retcpus);
+                          size_t *retcount,
+                          const char ***retcpus);
 
 /* Format:
  *      <arch> <model>
@@ -500,7 +500,7 @@ typedef int
  */
 static int
 qemuCapsParseX86Models(const char *output,
-                       unsigned int *retcount,
+                       size_t *retcount,
                        const char ***retcpus)
 {
     const char *p = output;
@@ -576,7 +576,7 @@ error:
  */
 static int
 qemuCapsParsePPCModels(const char *output,
-                       unsigned int *retcount,
+                       size_t *retcount,
                        const char ***retcpus)
 {
     const char *p = output;
@@ -646,7 +646,7 @@ int
 qemuCapsProbeCPUModels(const char *qemu,
                        qemuCapsPtr caps,
                        const char *arch,
-                       unsigned int *count,
+                       size_t *count,
                        const char ***cpus)
 {
     char *output = NULL;
@@ -703,9 +703,9 @@ qemuCapsInitGuest(virCapsPtr caps,
     char *binary = NULL;
     time_t binary_mtime;
     virCapsGuestMachinePtr *machines = NULL;
-    int nmachines = 0;
+    size_t nmachines = 0;
     struct stat st;
-    unsigned int ncpus;
+    size_t ncpus;
     qemuCapsPtr qemubinCaps = NULL;
     qemuCapsPtr kvmbinCaps = NULL;
     int ret = -1;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index cd104c0..9d31094 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -179,12 +179,12 @@ virCapsPtr qemuCapsInit(virCapsPtr old_caps);
 int qemuCapsProbeMachineTypes(const char *binary,
                               qemuCapsPtr caps,
                               virCapsGuestMachinePtr **machines,
-                              int *nmachines);
+                              size_t *nmachines);
 
 int qemuCapsProbeCPUModels(const char *qemu,
                            qemuCapsPtr caps,
                            const char *arch,
-                           unsigned int *count,
+                           size_t *count,
                            const char ***cpus);
 
 int qemuCapsExtractVersion(virCapsPtr caps,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5b4aeda..ea0b275 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4040,7 +4040,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
     const virCPUDefPtr host = driver->caps->host.cpu;
     virCPUDefPtr guest = NULL;
     virCPUDefPtr cpu = NULL;
-    unsigned int ncpus = 0;
+    size_t ncpus = 0;
     const char **cpus = NULL;
     const char *default_model;
     union cpuData *data = NULL;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index affb226..2bc9101 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5440,7 +5440,7 @@ static int
 qemudCanonicalizeMachineDirect(virDomainDefPtr def, char **canonical)
 {
     virCapsGuestMachinePtr *machines = NULL;
-    int i, nmachines = 0;
+    size_t i, nmachines = 0;
 
     /* XXX we should be checking emulator capabilities and pass them instead
      * of NULL so that -nodefconfig or -no-user-config is properly added when
-- 
1.7.11.4


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