From: Gerd Hoffmann Date: Mon, 13 Aug 2012 11:05:43 +0000 (+0200) Subject: Avoid asprintf() which is not available on mingw X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5f893b4e9c207c5a38cf7b141d2c54fa30046afd;p=qemu.git Avoid asprintf() which is not available on mingw Use g_strdup_printf() instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Stefan Weil Signed-off-by: Blue Swirl --- diff --git a/hw/msix.c b/hw/msix.c index 800fc32f0b..aea340b7c7 100644 --- a/hw/msix.c +++ b/hw/msix.c @@ -307,13 +307,9 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries, return -EINVAL; } - if (asprintf(&name, "%s-msix", dev->name) == -1) { - return -ENOMEM; - } - + name = g_strdup_printf("%s-msix", dev->name); memory_region_init(&dev->msix_exclusive_bar, name, MSIX_EXCLUSIVE_BAR_SIZE); - - free(name); + g_free(name); ret = msix_init(dev, nentries, &dev->msix_exclusive_bar, bar_nr, MSIX_EXCLUSIVE_BAR_TABLE_OFFSET, &dev->msix_exclusive_bar,