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

Re: [libvirt PATCH 5/7] cpu: Replace VIR_ALLOC with g_new0



On a Thursday in 2020, Tim Wiederhake wrote:
Signed-off-by: Tim Wiederhake <twiederh 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
@@ -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);

This combines the VIR_ALLOC -> g_new0 replacement with
other refactors.

For neat separation of changes into commits, it would be
nicer to have the other changes separate. But I could live
with the changes being here, if you mention them in the commit message.

Jano


}

static virCPUCompareResult
--
2.26.2

Attachment: signature.asc
Description: PGP signature


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