mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
cpu: Use g_strdup_printf() instead of virAsprintf()
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
daeeb3603d
commit
2b3061f2a1
@ -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 "
|
||||
if (message) {
|
||||
*message = g_strdup_printf(_("host CPU vendor does not match required "
|
||||
"CPU vendor %s"),
|
||||
cpu->vendor) < 0)
|
||||
goto cleanup;
|
||||
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 "
|
||||
if (message) {
|
||||
*message = g_strdup_printf(_("host CPU model does not match required "
|
||||
"CPU model %s"),
|
||||
guest_model->name) < 0)
|
||||
goto cleanup;
|
||||
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 "
|
||||
if (message) {
|
||||
*message = g_strdup_printf(_("host CPU vendor does not match required "
|
||||
"CPU vendor %s"),
|
||||
cpu->vendor) < 0)
|
||||
goto error;
|
||||
cpu->vendor);
|
||||
}
|
||||
|
||||
return VIR_CPU_COMPARE_INCOMPATIBLE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user