[libvirt] [PATCH 06/11] util: use glib base64 encoding/decoding APIs

Daniel P. Berrangé berrange at redhat.com
Mon Sep 30 13:19:07 UTC 2019


On Mon, Sep 30, 2019 at 09:02:36AM +0200, Peter Krempa wrote:
> On Fri, Sep 27, 2019 at 18:17:28 +0100, Daniel Berrange wrote:
> > Replace use of the gnulib base64 module with glib's own base64 API family.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> > ---
> >  bootstrap.conf                    |  1 -
> >  src/conf/virsecretobj.c           | 38 +++++++------------------------
> >  src/libvirt_private.syms          |  1 -
> >  src/libxl/libxl_conf.c            |  3 +--
> >  src/qemu/qemu_agent.c             |  9 +++-----
> >  src/qemu/qemu_command.c           |  5 ++--
> >  src/qemu/qemu_domain.c            |  8 +++----
> >  src/secret/secret_driver.c        |  1 -
> >  src/storage/storage_backend_rbd.c |  4 +---
> >  src/util/virstring.c              | 21 -----------------
> >  src/util/virstring.h              |  2 --
> >  tools/virsh-secret.c              | 17 ++++----------
> >  12 files changed, 22 insertions(+), 88 deletions(-)
> 
> [...]
> 
> > @@ -698,23 +697,17 @@ virSecretObjSaveConfig(virSecretObjPtr obj)
> >  int
> >  virSecretObjSaveData(virSecretObjPtr obj)
> >  {
> > -    char *base64 = NULL;
> > -    int ret = -1;
> > +    g_autofree char *base64 = NULL;
> 
> I'm not a fan of adding another style here. Either use VIR_FREE(), or
> convert all VIR_FREE to g_autofree first.
> 
> I'm aware it will be unavoidable to use the glib auto pointer macro for
> complex types but we should at least here where it's interchangable have
> some kind of consistency.

I was attempting to be consistent in matching g_new/g_free/g_autofree,
but as you say, it probably makes more sense to be consistent within
the scope of a single method.

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