Received: from eggs.gnu.org ([2001:4830:134:3::10]:38839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c73eD-0007Nk-5B for qemu-devel@nongnu.org; Wed, 16 Nov 2016 12:05:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c73e9-0005WY-Vv for qemu-devel@nongnu.org; Wed, 16 Nov 2016 12:05:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48612) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c73e9-0005WQ-Pj for qemu-devel@nongnu.org; Wed, 16 Nov 2016 12:05:17 -0500 Date: Wed, 16 Nov 2016 15:05:11 -0200 From: Eduardo Habkost Message-ID: <20161116170511.GQ5057@thinpad.lan.raisama.net> References: <1479312176-224580-1-git-send-email-imammedo@redhat.com> <1479312176-224580-2-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1479312176-224580-2-git-send-email-imammedo@redhat.com> Subject: Re: [Qemu-devel] [PATCH RFC 1/2] add bitmap_free() wrapper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, Alexey Kardashevskiy , Greg Kurz , David Gibson , Paolo Bonzini On Wed, Nov 16, 2016 at 05:02:55PM +0100, Igor Mammedov wrote: > it will be used for freeing bitmaps allocated with bitmap_[try]_new() > > Signed-off-by: Igor Mammedov We need to change all code using g_free() for bitmaps to use bitmap_free(), as people in the future might assume that changing bitmap_free() is safe (and it won't be). Personally, I think g_free() is good enough and we don't need bitmap_free(). The assumption that bitmap_new() returns g_free()-able memory is part of the API. > --- > include/qemu/bitmap.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h > index 63ea2d0..0289836 100644 > --- a/include/qemu/bitmap.h > +++ b/include/qemu/bitmap.h > @@ -98,6 +98,11 @@ static inline unsigned long *bitmap_new(long nbits) > return ptr; > } > > +static inline void bitmap_free(unsigned long *bitmap) > +{ > + g_free(bitmap); > +} > + > static inline void bitmap_zero(unsigned long *dst, long nbits) > { > if (small_nbits(nbits)) { > -- > 2.7.4 > -- Eduardo