1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

cpu: Replace VIR_ALLOC with g_new0

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Tim Wiederhake 2020-09-11 15:22:47 +02:00 committed by Ján Tomko
parent 535b4a56d2
commit ed83c6d9e9
2 changed files with 6 additions and 17 deletions

View File

@ -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;

View File

@ -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)