On Wed, Dec 07, 2011 at 01:40:57PM -0200, Eduardo Lima (Etrunko) wrote: > From: Eduardo Lima (Etrunko) <eblima@xxxxxxxxxx> > > Signed-off-by: Eduardo Lima (Etrunko) <eblima@xxxxxxxxxx> > --- > src/libvirt.c | 30 ++---------------------------- > 1 files changed, 2 insertions(+), 28 deletions(-) > > diff --git a/src/libvirt.c b/src/libvirt.c > index 68074e7..ca7a9a2 100644 > --- a/src/libvirt.c > +++ b/src/libvirt.c > @@ -1341,20 +1341,7 @@ failed: > virConnectPtr > virConnectOpen (const char *name) > { > - virConnectPtr ret = NULL; > - if (!initialized) > - if (virInitialize() < 0) > - goto error; > - > - VIR_DEBUG("name=%s", name); > - ret = do_open (name, NULL, 0); > - if (!ret) > - goto error; > - return ret; > - > -error: > - virDispatchError(NULL); > - return NULL; > + return virConnectOpenAuth(name, NULL, 0); > } > > /** > @@ -1375,20 +1362,7 @@ error: > virConnectPtr > virConnectOpenReadOnly(const char *name) > { > - virConnectPtr ret = NULL; > - if (!initialized) > - if (virInitialize() < 0) > - goto error; > - > - VIR_DEBUG("name=%s", name); > - ret = do_open (name, NULL, VIR_CONNECT_RO); > - if (!ret) > - goto error; > - return ret; > - > -error: > - virDispatchError(NULL); > - return NULL; > + return virConnectOpenAuth(name, NULL, VIR_CONNECT_RO); > } Unfortunately we can't really do this, because now the debug logs will always show virConnectOpenAuth, instead of the actual API that is being invoked. The code duplication we have there is the minimal possible while still getting correct debug logs. 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 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list