[libvirt PATCH v2 6/8] cpu: Replace VIR_ALLOC with g_new0

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/cpu/cpu.c       |  4 +---
 src/cpu/cpu_ppc64.c | 19 +++++--------------
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 69e4205e4b..c3eef52c79 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -286,9 +286,7 @@ virCPUDataNew(virArch arch)
 {
     virCPUDataPtr data;
 
-    if (VIR_ALLOC(data) < 0)
-        return NULL;
-
+    data = g_new0(virCPUData, 1);
     data->arch = arch;
 
     return data;
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index c0d09db696..ca2cfa0a67 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -189,9 +189,7 @@ ppc64ModelCopy(const virCPUppc64Model *model)
 {
     g_autoptr(virCPUppc64Model) copy = NULL;
 
-    if (VIR_ALLOC(copy) < 0)
-        return NULL;
-
+    copy = g_new0(virCPUppc64Model, 1);
     copy->name = g_strdup(model->name);
 
     if (ppc64DataCopy(&copy->data, &model->data) < 0)
@@ -283,9 +281,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
     virCPUppc64MapPtr map = data;
     g_autoptr(virCPUppc64Vendor) vendor = NULL;
 
-    if (VIR_ALLOC(vendor) < 0)
-        return -1;
-
+    vendor = g_new0(virCPUppc64Vendor, 1);
     vendor->name = g_strdup(name);
 
     if (ppc64VendorFind(map, vendor->name)) {
@@ -314,9 +310,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
     size_t i;
     int n;
 
-    if (VIR_ALLOC(model) < 0)
-        return -1;
-
+    model = g_new0(virCPUppc64Model, 1);
     model->name = g_strdup(name);
 
     if (ppc64ModelFind(map, model->name)) {
@@ -386,8 +380,7 @@ ppc64LoadMap(void)
 {
     g_autoptr(virCPUppc64Map) map = NULL;
 
-    if (VIR_ALLOC(map) < 0)
-        return NULL;
+    map = g_new0(virCPUppc64Map, 1);
 
     if (cpuMapLoad("ppc64", ppc64VendorParse, NULL, ppc64ModelParse, map) < 0)
         return NULL;
@@ -401,9 +394,7 @@ ppc64MakeCPUData(virArch arch,
 {
     g_autoptr(virCPUData) cpuData = NULL;
 
-    if (VIR_ALLOC(cpuData) < 0)
-        return NULL;
-
+    cpuData = g_new0(virCPUData, 1);
     cpuData->arch = arch;
 
     if (ppc64DataCopy(&cpuData->data.ppc64, data) < 0)
-- 
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