[libvirt] [PATCH 04/11] util: use glib memory allocation functions

Pavel Hrdina phrdina at redhat.com
Mon Sep 30 10:18:11 UTC 2019


On Mon, Sep 30, 2019 at 11:08:09AM +0100, Daniel P. Berrangé wrote:
> On Mon, Sep 30, 2019 at 12:02:17PM +0200, Pavel Hrdina wrote:
> > On Fri, Sep 27, 2019 at 06:17:26PM +0100, Daniel P. Berrangé wrote:
> > > Convert the VIR_ALLOC family of APIs with use of the g_malloc family of
> > > APIs. Use of VIR_ALLOC related functions should be incrementally phased
> > > out over time, allowing return value checks to be dropped. Use of
> > > VIR_FREE should be replaced with auto-cleanup whenever possible.
> > > 
> > > We previously used the 'calloc-posix' gnulib module because mingw does
> > > not set errno to ENOMEM on failure.
> > > 
> > > Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> > > ---
> > >  bootstrap.conf      |  1 -
> > >  src/util/viralloc.c | 29 ++++++-----------------------
> > >  2 files changed, 6 insertions(+), 24 deletions(-)
> > 
> > \o/ Another gnulib module removed.  On Friday I was trying to figure out
> > how to incorporate gnulib into meson build system and it's not easy at
> > all and still I did not verify that it actually works so we might need
> > to get rid of gnulib before we can do that conversion.
> 
> I think it is possible roughly as follows
> 
>   - Create a minimal configure.ac that only runs gnulib, nothing else
>   - In meson, we have to run 'configure' using 'run_command'
>   - Define 'custom_target' that invokes 'make'
>   - Declare a dependancy for the result of the custom_target and
>     add that as a pre-req for every other target
> 
> The main problem when I was exploring this is that 'run_command' does
> not show any output from configure. So you don't see the progress
> messages from configure. This is not nice, but also not the end of the
> world since this configure script will be much smaller than what we have
> today, and getting ever smaller as we purge more gnulib.

I have it in a similar way except that I don't use 'run_command' but
only 'custom_target' as I don't want to pollute source dire.  It
actually compiles and the static library libgnu.a is generated.  I just
did not compile any executable that would actually use gnulib and tested
it that it works.  But I'll definitely try to finish it and post some
RFC patches to list so we can discuss that solution and figure out what
to do.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190930/54f90e0c/attachment-0001.sig>


More information about the libvir-list mailing list