Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/cpu/cpu.c | 4 +---
src/cpu/cpu_ppc64.c | 25 ++++++++-----------------
2 files changed, 9 insertions(+), 20 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 28fbfea9ae..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(©->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;
@@ -399,17 +392,15 @@ static virCPUDataPtr
ppc64MakeCPUData(virArch arch,
virCPUppc64Data *data)
{
- virCPUDataPtr cpuData;
-
- if (VIR_ALLOC(cpuData) < 0)
- return NULL;
+ g_autoptr(virCPUData) cpuData = NULL;
+ cpuData = g_new0(virCPUData, 1);
cpuData->arch = arch;
if (ppc64DataCopy(&cpuData->data.ppc64, data) < 0)
- VIR_FREE(cpuData);
+ return NULL;
- return cpuData;
+ return g_steal_pointer(&cpuData);
}
static virCPUCompareResult
--
2.26.2