[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64)
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64) |
Date: |
Fri, 10 Aug 2012 16:18:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) |
Gerd Hoffmann <address@hidden> writes:
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
> hw/msix.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/hw/msix.c b/hw/msix.c
> index 800fc32..04345f2 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -307,9 +307,8 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned
> short nentries,
> return -EINVAL;
> }
>
> - if (asprintf(&name, "%s-msix", dev->name) == -1) {
> - return -ENOMEM;
> - }
> + name = g_malloc(sizeof(dev->name) + 5);
> + snprintf(name, sizeof(dev->name) + 5, "%s-msix", dev->name);
>
> memory_region_init(&dev->msix_exclusive_bar, name,
> MSIX_EXCLUSIVE_BAR_SIZE);
What about g_strdup_printf()?