[libvirt] [PATCH libvirt-glib] Don't reference GError **err parameter if it is NULL

Daniel P. Berrange berrange at redhat.com
Tue Nov 22 15:42:29 UTC 2011


On Tue, Nov 22, 2011 at 03:50:46PM +0100, Christophe Fergeau wrote:
> On Tue, Nov 22, 2011 at 02:18:15PM +0000, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> > 
> > ---
> >  libvirt-gobject/libvirt-gobject-connection.c     |  104 +++++++++++++---------
> >  libvirt-gobject/libvirt-gobject-domain.c         |   70 ++++++++------
> >  libvirt-gobject/libvirt-gobject-interface.c      |    7 +-
> >  libvirt-gobject/libvirt-gobject-network-filter.c |    7 +-
> >  libvirt-gobject/libvirt-gobject-network.c        |    7 +-
> >  libvirt-gobject/libvirt-gobject-node-device.c    |    7 +-
> >  libvirt-gobject/libvirt-gobject-secret.c         |    7 +-
> >  libvirt-gobject/libvirt-gobject-storage-pool.c   |   53 +++++++-----
> >  libvirt-gobject/libvirt-gobject-storage-vol.c    |    7 +-
> >  9 files changed, 158 insertions(+), 111 deletions(-)
> > 
> > diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
> > index affb496..35be5e3 100644
> > --- a/libvirt-gobject/libvirt-gobject-connection.c
> > +++ b/libvirt-gobject/libvirt-gobject-connection.c
> > @@ -389,19 +389,21 @@ gboolean gvir_connection_open(GVirConnection *conn,
> >  
> >      g_mutex_lock(priv->lock);
> >      if (priv->conn) {
> > -        *err = g_error_new(GVIR_CONNECTION_ERROR,
> > -                           0,
> > -                           "Connection %s is already open",
> > -                           priv->uri);
> > +        if (err)
> > +            *err = g_error_new(GVIR_CONNECTION_ERROR,
> > +                               0,
> > +                               "Connection %s is already open",
> > +                               priv->uri);
> 
> g_set_error(err, GVIR_CONNECTION_ERROR, 0, "Connection...); does exactly
> that (test for non-NULL + g_error_new). I'm fine with this patch (ie ACK
> from me), but it would be even better to introduce gvir_set_error(...) and
> to use that. This can be done later though.

I'm pushing this patch now for 0.0.2 release, and then I'll followup
with a patch todo what you suggest for 0.0.3

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list