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

Daniel P. Berrangé berrange at redhat.com
Mon Sep 30 10:27:12 UTC 2019


On Mon, Sep 30, 2019 at 12:18:11PM +0200, Pavel Hrdina wrote:
> 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.

Looks like wiring up a custom target as a dependancy is not quite as
simple as I thought. There's a recentish enhancement to support it
though:

  https://github.com/mesonbuild/meson/pull/5103

Seems to need a fairly new meson though (>= 0.51 IIUC)

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 :|




More information about the libvir-list mailing list