提交 91813b87 编写于 作者: P Peter Krempa

qemu: agent: Avoid unnecessary JSON object type check

Use virJSONValueObjectGetArray instead of virJSONValueObjectGet so that
it's not necessary to check whether it's an array.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
上级 d78a91af
......@@ -1502,18 +1502,12 @@ qemuAgentGetVCPUs(qemuAgentPtr mon,
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0)
goto cleanup;
if (!(data = virJSONValueObjectGet(reply, "return"))) {
if (!(data = virJSONValueObjectGetArray(reply, "return"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("guest-get-vcpus reply was missing return data"));
goto cleanup;
}
if (data->type != VIR_JSON_TYPE_ARRAY) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("guest-get-vcpus return information was not an array"));
goto cleanup;
}
ndata = virJSONValueArraySize(data);
if (VIR_ALLOC_N(*info, ndata) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册