[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] bitmap: Use g_try_new0/g_renew
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH v2] bitmap: Use g_try_new0/g_renew |
Date: |
Thu, 2 May 2024 16:44:19 +0100 |
User-agent: |
Mutt/2.2.12 (2023-09-09) |
On Thu, May 02, 2024 at 05:22:42PM +0200, Paolo Bonzini wrote:
> Avoids an explicit use of sizeof(). The GLib allocation macros
> ensure that the multiplication by the size of the element
> uses the right type and does not overflow.
>
> While at it, change bitmap_new() to use g_new0 directly. Its current
> impl of calling bitmap_try_new() followed by a plain abort() has
> worse diagnostics than g_new0, which uses g_error to report the actual
> allocation size that failed.
>
> Cc: qemu-trivial@nongnu.org
> Cc: Roman Kiryanov <rkir@google.com>
> Cc: Daniel Berrange <berrange@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/qemu/bitmap.h | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|