mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
qemuMonitorJSONGetDeviceProps: Refactor to modern standards
Use automatic cleanup of variables and current style of header. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -6745,13 +6745,13 @@ qemuMonitorJSONParsePropsList(virJSONValuePtr cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
|
int
|
||||||
|
qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
|
||||||
const char *device,
|
const char *device,
|
||||||
char ***props)
|
char ***props)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
g_autoptr(virJSONValue) cmd = NULL;
|
||||||
virJSONValuePtr cmd;
|
g_autoptr(virJSONValue) reply = NULL;
|
||||||
virJSONValuePtr reply = NULL;
|
|
||||||
|
|
||||||
*props = NULL;
|
*props = NULL;
|
||||||
|
|
||||||
@@ -6761,18 +6761,12 @@ int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) {
|
if (qemuMonitorJSONHasError(reply, "DeviceNotFound"))
|
||||||
ret = 0;
|
return 0;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = qemuMonitorJSONParsePropsList(cmd, reply, NULL, props);
|
return qemuMonitorJSONParsePropsList(cmd, reply, NULL, props);
|
||||||
cleanup:
|
|
||||||
virJSONValueFree(reply);
|
|
||||||
virJSONValueFree(cmd);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user