On 10/06/2017 07:49 PM, Philippe Mathieu-Daudé wrote: > From: Marc-André Lureau <marcandre.lur...@redhat.com> > > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> > [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 <js...@redhat.com> And for convenience, this can be staged by whomever wishes to stage the whole 88 patch enchilada: Acked-by: John Snow <js...@redhat.com>