[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/22] hw/riscv/virt: Replace sprintf by g_strdup_printf
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 09/22] hw/riscv/virt: Replace sprintf by g_strdup_printf |
Date: |
Thu, 25 Apr 2024 13:01:42 +0200 |
sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1.
Use g_strdup_printf instead.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
[rth: Use g_strdup_printf]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240412073346.458116-26-richard.henderson@linaro.org>
---
hw/riscv/virt.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index d171e74f7b..4fdb660525 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1617,10 +1617,8 @@ static void virt_machine_instance_init(Object *obj)
static char *virt_get_aia_guests(Object *obj, Error **errp)
{
RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
- char val[32];
- sprintf(val, "%d", s->aia_guests);
- return g_strdup(val);
+ return g_strdup_printf("%d", s->aia_guests);
}
static void virt_set_aia_guests(Object *obj, const char *val, Error **errp)
@@ -1741,7 +1739,6 @@ static void virt_machine_device_plug_cb(HotplugHandler
*hotplug_dev,
static void virt_machine_class_init(ObjectClass *oc, void *data)
{
- char str[128];
MachineClass *mc = MACHINE_CLASS(oc);
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
@@ -1767,7 +1764,6 @@ static void virt_machine_class_init(ObjectClass *oc, void
*data)
machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
#endif
-
object_class_property_add_bool(oc, "aclint", virt_get_aclint,
virt_set_aclint);
object_class_property_set_description(oc, "aclint",
@@ -1785,9 +1781,14 @@ static void virt_machine_class_init(ObjectClass *oc,
void *data)
object_class_property_add_str(oc, "aia-guests",
virt_get_aia_guests,
virt_set_aia_guests);
- sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid value "
- "should be between 0 and %d.", VIRT_IRQCHIP_MAX_GUESTS);
- object_class_property_set_description(oc, "aia-guests", str);
+ {
+ g_autofree char *str =
+ g_strdup_printf("Set number of guest MMIO pages for AIA IMSIC. "
+ "Valid value should be between 0 and %d.",
+ VIRT_IRQCHIP_MAX_GUESTS);
+ object_class_property_set_description(oc, "aia-guests", str);
+ }
+
object_class_property_add(oc, "acpi", "OnOffAuto",
virt_get_acpi, virt_set_acpi,
NULL, NULL);
--
2.41.0
- [PULL 02/22] qmp: add dump machine type compatibility properties, (continued)
- [PULL 02/22] qmp: add dump machine type compatibility properties, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 03/22] python/qemu/machine: add method to retrieve QEMUMachine::binary field, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 04/22] scripts: add script to compare compatibility properties, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 05/22] hw/core: Remove check on NEED_CPU_H in tcg-cpu-ops.h, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 07/22] hw/misc/applesmc: Simplify DeviceReset handler, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 08/22] hw/misc/imx: Replace sprintf() by snprintf(), Philippe Mathieu-Daudé, 2024/04/25
- [PULL 06/22] target/i386: Move APIC related code to cpu-apic.c, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 14/22] hw/cxl/cxl-cdat: Make cxl_doe_cdat_init() return boolean, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 19/22] hw/core/machine: Introduce the module as a CPU topology level, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 18/22] hw/i386/pc_sysfw: Remove unused parameter from pc_isa_bios_init(), Philippe Mathieu-Daudé, 2024/04/25
- [PULL 09/22] hw/riscv/virt: Replace sprintf by g_strdup_printf,
Philippe Mathieu-Daudé <=
- [PULL 12/22] hw/cxl/cxl-cdat: Make ct3_load_cdat() return boolean, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 13/22] hw/cxl/cxl-cdat: Make ct3_build_cdat() return boolean, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 16/22] hw/xtensa: Include missing 'exec/cpu-common.h' in 'bootparam.h', Philippe Mathieu-Daudé, 2024/04/25
- [PULL 15/22] hw/elf_ops: Rename elf_ops.h -> elf_ops.h.inc, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 10/22] hw: Fix problem with the A*MPCORE switches in the Kconfig files, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 20/22] hw/core/machine: Support modules in -smp, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 11/22] hw: Add a Kconfig switch for the TYPE_CPU_CLUSTER device, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 21/22] hw/core: Introduce module-id as the topology subindex, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 22/22] hw/core: Support module-id in numa configuration, Philippe Mathieu-Daudé, 2024/04/25
- [PULL 17/22] hw/misc : Correct 5 spaces indents in stm32l4x5_exti, Philippe Mathieu-Daudé, 2024/04/25