[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH 13/88] Dirty Bitmaps: use g_new()
From: |
John Snow |
Subject: |
Re: [Qemu-trivial] [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>
- Re: [Qemu-trivial] [PATCH 04/88] cocci: avoid use of g_new0(), (continued)
- [Qemu-trivial] [PATCH 05/88] cocci: use g_strfreev(), Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 07/88] Audio: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 06/88] ARM: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 08/88] BT: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 09/88] Bootdevice: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 10/88] Character devices: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 11/88] Cryptodev Backends: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 12/88] backends/hostmem: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 13/88] Dirty Bitmaps: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- Re: [Qemu-trivial] [Qemu-devel] [PATCH 13/88] Dirty Bitmaps: use g_new() family of functions,
John Snow <=
- [Qemu-trivial] [PATCH 14/88] ui/vnc: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 15/88] ui/spice: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 17/88] Memory API: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 16/88] Main loop: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 18/88] memory: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 19/88] exec: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 20/88] Migration: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 21/88] NBD: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06