mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
ch: use g_auto in virCHMonitorBuildCPUJson
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
ef8f06c882
commit
25ffb2ce86
@ -58,7 +58,7 @@ int virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint);
|
|||||||
static int
|
static int
|
||||||
virCHMonitorBuildCPUJson(virJSONValue *content, virDomainDef *vmdef)
|
virCHMonitorBuildCPUJson(virJSONValue *content, virDomainDef *vmdef)
|
||||||
{
|
{
|
||||||
virJSONValue *cpus;
|
g_autoptr(virJSONValue) cpus = NULL;
|
||||||
unsigned int maxvcpus = 0;
|
unsigned int maxvcpus = 0;
|
||||||
unsigned int nvcpus = 0;
|
unsigned int nvcpus = 0;
|
||||||
virDomainVcpuDef *vcpu;
|
virDomainVcpuDef *vcpu;
|
||||||
@ -75,18 +75,14 @@ virCHMonitorBuildCPUJson(virJSONValue *content, virDomainDef *vmdef)
|
|||||||
if (maxvcpus != 0 || nvcpus != 0) {
|
if (maxvcpus != 0 || nvcpus != 0) {
|
||||||
cpus = virJSONValueNewObject();
|
cpus = virJSONValueNewObject();
|
||||||
if (virJSONValueObjectAppendNumberInt(cpus, "boot_vcpus", nvcpus) < 0)
|
if (virJSONValueObjectAppendNumberInt(cpus, "boot_vcpus", nvcpus) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (virJSONValueObjectAppendNumberInt(cpus, "max_vcpus", vmdef->maxvcpus) < 0)
|
if (virJSONValueObjectAppendNumberInt(cpus, "max_vcpus", vmdef->maxvcpus) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (virJSONValueObjectAppend(content, "cpus", &cpus) < 0)
|
if (virJSONValueObjectAppend(content, "cpus", &cpus) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
virJSONValueFree(cpus);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user