qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 13/88] Dirty Bitmaps: use g_new() family of func


From: John Snow
Subject: Re: [Qemu-devel] [PATCH 13/88] Dirty Bitmaps: use g_new() family of functions
Date: Sat, 7 Oct 2017 11:45:21 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0


On 10/06/2017 07:49 PM, Philippe Mathieu-Daudé wrote:
> From: Marc-André Lureau <address@hidden>
> 
> Signed-off-by: Marc-André Lureau <address@hidden>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> [PMD: squashed tests/test-hbitmap.c changes]
> ---
>  tests/test-hbitmap.c | 2 +-
>  util/hbitmap.c       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/test-hbitmap.c b/tests/test-hbitmap.c
> index af41642346..fea3a64712 100644
> --- a/tests/test-hbitmap.c
> +++ b/tests/test-hbitmap.c
> @@ -122,7 +122,7 @@ static void hbitmap_test_truncate_impl(TestHBitmapData 
> *data,
>  
>      n = hbitmap_test_array_size(size);
>      m = hbitmap_test_array_size(data->old_size);
> -    data->bits = g_realloc(data->bits, sizeof(unsigned long) * n);
> +    data->bits = g_renew(unsigned long, data->bits, n);
>      if (n > m) {
>          memset(&data->bits[m], 0x00, sizeof(unsigned long) * (n - m));
>      }
> diff --git a/util/hbitmap.c b/util/hbitmap.c
> index 2f9d0fdbd0..4eb0188836 100644
> --- a/util/hbitmap.c
> +++ b/util/hbitmap.c
> @@ -668,7 +668,7 @@ void hbitmap_truncate(HBitmap *hb, uint64_t size)
>          }
>          old = hb->sizes[i];
>          hb->sizes[i] = size;
> -        hb->levels[i] = g_realloc(hb->levels[i], size * sizeof(unsigned 
> long));
> +        hb->levels[i] = g_renew(unsigned long, hb->levels[i], size);
>          if (!shrink) {
>              memset(&hb->levels[i][old], 0x00,
>                     (size - old) * sizeof(*hb->levels[i]));
> 

Hm, I guess g_renew() isn't a new addition to glib, and we can safely
use it.

Reviewed-by: John Snow <address@hidden>

And for convenience, this can be staged by whomever wishes to stage the
whole 88 patch enchilada:

Acked-by: John Snow <address@hidden>



reply via email to

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