mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuMonitorJSONGetAllBlockJobInfo: Remove superfluous goto
s
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
5b7e88322d
commit
7db3db301c
@ -5074,39 +5074,34 @@ qemuMonitorJSONGetAllBlockJobInfo(qemuMonitor *mon,
|
|||||||
virJSONValue *data;
|
virJSONValue *data;
|
||||||
size_t nr_results;
|
size_t nr_results;
|
||||||
size_t i;
|
size_t i;
|
||||||
g_autoptr(GHashTable) blockJobs = NULL;
|
g_autoptr(GHashTable) blockJobs = virHashNew(g_free);
|
||||||
|
|
||||||
cmd = qemuMonitorJSONMakeCommand("query-block-jobs", NULL);
|
cmd = qemuMonitorJSONMakeCommand("query-block-jobs", NULL);
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||||
goto cleanup;
|
return NULL;
|
||||||
|
|
||||||
if ((data = virJSONValueObjectGetArray(reply, "return")) == NULL) {
|
if ((data = virJSONValueObjectGetArray(reply, "return")) == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("reply was missing return data"));
|
_("reply was missing return data"));
|
||||||
goto cleanup;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nr_results = virJSONValueArraySize(data);
|
nr_results = virJSONValueArraySize(data);
|
||||||
blockJobs = virHashNew(g_free);
|
|
||||||
|
|
||||||
for (i = 0; i < nr_results; i++) {
|
for (i = 0; i < nr_results; i++) {
|
||||||
virJSONValue *entry = virJSONValueArrayGet(data, i);
|
virJSONValue *entry = virJSONValueArrayGet(data, i);
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("missing array element"));
|
_("missing array element"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (qemuMonitorJSONParseBlockJobInfo(blockJobs, entry, rawjobname) < 0)
|
if (qemuMonitorJSONParseBlockJobInfo(blockJobs, entry, rawjobname) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return g_steal_pointer(&blockJobs);
|
return g_steal_pointer(&blockJobs);
|
||||||
|
|
||||||
error:
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user