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