[libvirt PATCH v2 7/8] cpu: Replace VIR_ALLOC_N with g_new0

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/cpu/cpu_ppc64.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index ca2cfa0a67..6477b4bce7 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -134,9 +134,7 @@ ppc64DataCopy(virCPUppc64Data *dst, const virCPUppc64Data *src)
 {
     size_t i;
 
-    if (VIR_ALLOC_N(dst->pvr, src->len) < 0)
-        return -1;
-
+    dst->pvr = g_new0(virCPUppc64PVR, src->len);
     dst->len = src->len;
 
     for (i = 0; i < src->len; i++) {
@@ -343,9 +341,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
         return -1;
     }
 
-    if (VIR_ALLOC_N(model->data.pvr, n) < 0)
-        return -1;
-
+    model->data.pvr = g_new0(virCPUppc64PVR, n);
     model->data.len = n;
 
     for (i = 0; i < n; i++) {
@@ -603,10 +599,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu,
         return -1;
 
     data = &cpuData->data.ppc64;
-
-    if (VIR_ALLOC_N(data->pvr, 1) < 0)
-        return -1;
-
+    data->pvr = g_new0(virCPUppc64PVR, 1);
     data->len = 1;
 
 #if defined(__powerpc__) || defined(__powerpc64__)
@@ -732,8 +725,7 @@ virCPUppc64DriverGetModels(char ***models)
         return -1;
 
     if (models) {
-        if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0)
-            return -1;
+        *models = g_new0(char*, map->nmodels + 1);
 
         for (i = 0; i < map->nmodels; i++)
             (*models)[i] = g_strdup(map->models[i]->name);
-- 
2.26.2




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

  Powered by Linux