提交 bc62d7a4 编写于 作者: J Jiri Denemark

cpu_x86: Use g_auto* in virCPUx86Compare

Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 edf3c904
...@@ -1847,32 +1847,30 @@ virCPUx86Compare(virCPUDefPtr host, ...@@ -1847,32 +1847,30 @@ virCPUx86Compare(virCPUDefPtr host,
virCPUDefPtr cpu, virCPUDefPtr cpu,
bool failIncompatible) bool failIncompatible)
{ {
virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; virCPUCompareResult ret;
char *message = NULL; g_autofree char *message = NULL;
if (!host || !host->model) { if (!host || !host->model) {
if (failIncompatible) { if (failIncompatible) {
virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
_("unknown host CPU")); _("unknown host CPU"));
} else { return VIR_CPU_COMPARE_ERROR;
VIR_WARN("unknown host CPU");
ret = VIR_CPU_COMPARE_INCOMPATIBLE;
} }
goto cleanup;
VIR_WARN("unknown host CPU");
return VIR_CPU_COMPARE_INCOMPATIBLE;
} }
ret = x86Compute(host, cpu, NULL, &message); ret = x86Compute(host, cpu, NULL, &message);
if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) { if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) {
ret = VIR_CPU_COMPARE_ERROR;
if (message) if (message)
virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message); virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
else else
virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
return VIR_CPU_COMPARE_ERROR;
} }
cleanup:
VIR_FREE(message);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册