[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/12] hw/vfio/pci: Replace sprintf() by g_strdup_printf()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 02/12] hw/vfio/pci: Replace sprintf() by g_strdup_printf() |
Date: |
Wed, 10 Apr 2024 18:06:03 +0200 |
sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience. Use g_strdup_printf()
instead.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/vfio/pci.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 64780d1b79..cc3cc89122 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2442,10 +2442,9 @@ void vfio_pci_post_reset(VFIOPCIDevice *vdev)
bool vfio_pci_host_match(PCIHostDeviceAddress *addr, const char *name)
{
- char tmp[13];
-
- sprintf(tmp, "%04x:%02x:%02x.%1x", addr->domain,
- addr->bus, addr->slot, addr->function);
+ g_autofree char *tmp = g_strdup_printf("%04x:%02x:%02x.%1x",
+ addr->domain, addr->bus,
+ addr->slot, addr->function);
return (strcmp(tmp, name) == 0);
}
--
2.41.0
- [PATCH 00/12] misc: Remove sprintf() due to macOS deprecation, Philippe Mathieu-Daudé, 2024/04/10
- [PATCH 02/12] hw/vfio/pci: Replace sprintf() by g_strdup_printf(),
Philippe Mathieu-Daudé <=
- [PATCH 03/12] hw/ppc/spapr: Replace sprintf() by g_strdup_printf(), Philippe Mathieu-Daudé, 2024/04/10
- [PATCH 05/12] system/qtest: Replace sprintf() by g_string_append_printf(), Philippe Mathieu-Daudé, 2024/04/10
- [PATCH 04/12] hw/mips/malta: Replace sprintf() by g_string_append_printf(), Philippe Mathieu-Daudé, 2024/04/10
- [PATCH 06/12] util/hexdump: Rename @offset argument in qemu_hexdump_line(), Philippe Mathieu-Daudé, 2024/04/10
- [PATCH 07/12] util/hexdump: Have qemu_hexdump_line() return heap allocated buffer, Philippe Mathieu-Daudé, 2024/04/10
- [PATCH 08/12] util/hexdump: Replace sprintf() by g_string_append_printf(), Philippe Mathieu-Daudé, 2024/04/10
- [PATCH 09/12] hw/scsi/scsi-disk: Use qemu_hexdump_line() to avoid sprintf(), Philippe Mathieu-Daudé, 2024/04/10