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:
parent
535b4a56d2
commit
ed83c6d9e9
@ -286,9 +286,7 @@ virCPUDataNew(virArch arch)
|
|||||||
{
|
{
|
||||||
virCPUDataPtr data;
|
virCPUDataPtr data;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(virCPUData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
data->arch = arch;
|
data->arch = arch;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -189,9 +189,7 @@ ppc64ModelCopy(const virCPUppc64Model *model)
|
|||||||
{
|
{
|
||||||
g_autoptr(virCPUppc64Model) copy = NULL;
|
g_autoptr(virCPUppc64Model) copy = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(copy) < 0)
|
copy = g_new0(virCPUppc64Model, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
copy->name = g_strdup(model->name);
|
copy->name = g_strdup(model->name);
|
||||||
|
|
||||||
if (ppc64DataCopy(©->data, &model->data) < 0)
|
if (ppc64DataCopy(©->data, &model->data) < 0)
|
||||||
@ -283,9 +281,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
|
|||||||
virCPUppc64MapPtr map = data;
|
virCPUppc64MapPtr map = data;
|
||||||
g_autoptr(virCPUppc64Vendor) vendor = NULL;
|
g_autoptr(virCPUppc64Vendor) vendor = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(vendor) < 0)
|
vendor = g_new0(virCPUppc64Vendor, 1);
|
||||||
return -1;
|
|
||||||
|
|
||||||
vendor->name = g_strdup(name);
|
vendor->name = g_strdup(name);
|
||||||
|
|
||||||
if (ppc64VendorFind(map, vendor->name)) {
|
if (ppc64VendorFind(map, vendor->name)) {
|
||||||
@ -314,9 +310,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
|
|||||||
size_t i;
|
size_t i;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (VIR_ALLOC(model) < 0)
|
model = g_new0(virCPUppc64Model, 1);
|
||||||
return -1;
|
|
||||||
|
|
||||||
model->name = g_strdup(name);
|
model->name = g_strdup(name);
|
||||||
|
|
||||||
if (ppc64ModelFind(map, model->name)) {
|
if (ppc64ModelFind(map, model->name)) {
|
||||||
@ -386,8 +380,7 @@ ppc64LoadMap(void)
|
|||||||
{
|
{
|
||||||
g_autoptr(virCPUppc64Map) map = NULL;
|
g_autoptr(virCPUppc64Map) map = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(map) < 0)
|
map = g_new0(virCPUppc64Map, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (cpuMapLoad("ppc64", ppc64VendorParse, NULL, ppc64ModelParse, map) < 0)
|
if (cpuMapLoad("ppc64", ppc64VendorParse, NULL, ppc64ModelParse, map) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -401,9 +394,7 @@ ppc64MakeCPUData(virArch arch,
|
|||||||
{
|
{
|
||||||
g_autoptr(virCPUData) cpuData = NULL;
|
g_autoptr(virCPUData) cpuData = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(cpuData) < 0)
|
cpuData = g_new0(virCPUData, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
cpuData->arch = arch;
|
cpuData->arch = arch;
|
||||||
|
|
||||||
if (ppc64DataCopy(&cpuData->data.ppc64, data) < 0)
|
if (ppc64DataCopy(&cpuData->data.ppc64, data) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user