提交 2b3061f2 编写于 作者: M Michal Privoznik

cpu: Use g_strdup_printf() instead of virAsprintf()

Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 daeeb360
......@@ -459,11 +459,9 @@ ppc64Compute(virCPUDefPtr host,
if (!found) {
VIR_DEBUG("CPU arch %s does not match host arch",
virArchToString(cpu->arch));
if (message &&
virAsprintf(message,
_("CPU arch %s does not match host arch"),
virArchToString(cpu->arch)) < 0)
goto cleanup;
if (message)
*message = g_strdup_printf(_("CPU arch %s does not match host arch"),
virArchToString(cpu->arch));
ret = VIR_CPU_COMPARE_INCOMPATIBLE;
goto cleanup;
......@@ -477,12 +475,11 @@ ppc64Compute(virCPUDefPtr host,
(!host->vendor || STRNEQ(cpu->vendor, host->vendor))) {
VIR_DEBUG("host CPU vendor does not match required CPU vendor %s",
cpu->vendor);
if (message &&
virAsprintf(message,
_("host CPU vendor does not match required "
"CPU vendor %s"),
cpu->vendor) < 0)
goto cleanup;
if (message) {
*message = g_strdup_printf(_("host CPU vendor does not match required "
"CPU vendor %s"),
cpu->vendor);
}
ret = VIR_CPU_COMPARE_INCOMPATIBLE;
goto cleanup;
......@@ -532,12 +529,11 @@ ppc64Compute(virCPUDefPtr host,
if (STRNEQ(guest_model->name, host_model->name)) {
VIR_DEBUG("host CPU model does not match required CPU model %s",
guest_model->name);
if (message &&
virAsprintf(message,
_("host CPU model does not match required "
"CPU model %s"),
guest_model->name) < 0)
goto cleanup;
if (message) {
*message = g_strdup_printf(_("host CPU model does not match required "
"CPU model %s"),
guest_model->name);
}
ret = VIR_CPU_COMPARE_INCOMPATIBLE;
goto cleanup;
......
......@@ -1721,11 +1721,8 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
virReportOOMError(); \
goto error; \
} \
if (message && \
virAsprintf(message, "%s: %s", _(MSG), flagsStr) < 0) { \
VIR_FREE(flagsStr); \
goto error; \
} \
if (message) \
*message = g_strdup_printf("%s: %s", _(MSG), flagsStr); \
VIR_DEBUG("%s: %s", MSG, flagsStr); \
VIR_FREE(flagsStr); \
ret = VIR_CPU_COMPARE_INCOMPATIBLE; \
......@@ -1766,11 +1763,10 @@ x86Compute(virCPUDefPtr host,
if (!found) {
VIR_DEBUG("CPU arch %s does not match host arch",
virArchToString(cpu->arch));
if (message &&
virAsprintf(message,
_("CPU arch %s does not match host arch"),
virArchToString(cpu->arch)) < 0)
goto error;
if (message) {
*message = g_strdup_printf(_("CPU arch %s does not match host arch"),
virArchToString(cpu->arch));
}
return VIR_CPU_COMPARE_INCOMPATIBLE;
}
arch = cpu->arch;
......@@ -1782,12 +1778,11 @@ x86Compute(virCPUDefPtr host,
(!host->vendor || STRNEQ(cpu->vendor, host->vendor))) {
VIR_DEBUG("host CPU vendor does not match required CPU vendor %s",
cpu->vendor);
if (message &&
virAsprintf(message,
_("host CPU vendor does not match required "
"CPU vendor %s"),
cpu->vendor) < 0)
goto error;
if (message) {
*message = g_strdup_printf(_("host CPU vendor does not match required "
"CPU vendor %s"),
cpu->vendor);
}
return VIR_CPU_COMPARE_INCOMPATIBLE;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册