qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] hw/vfio/platform: replace g_malloc0_n by g_mall


From: Gonglei
Subject: Re: [Qemu-devel] [PATCH] hw/vfio/platform: replace g_malloc0_n by g_malloc0
Date: Thu, 11 Jun 2015 15:55:56 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 2015/6/11 15:14, Eric Auger wrote:
> g_malloc0_n() is introduced since glib-2.24 while QEMU currently
> requires glib-2.22. This may cause a link error on some distributions.
> 
> Signed-off-by: Eric Auger <address@hidden>
> ---
>  hw/vfio/platform.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
> index 35266a8..c0acc8b 100644
> --- a/hw/vfio/platform.c
> +++ b/hw/vfio/platform.c
> @@ -346,8 +346,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
>          return ret;
>      }
>  
> -    vdev->regions = g_malloc0_n(vbasedev->num_regions,
> -                                sizeof(VFIORegion *));
> +    vdev->regions = g_malloc0(vbasedev->num_regions * sizeof(VFIORegion *));
>  

Why not use g_new0() which returned pointer is cast to the given type?

Regards,
-Gonglei
>      for (i = 0; i < vbasedev->num_regions; i++) {
>          struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]