[libvirt] [PATCH 6/8] Remove virConnectPtr from interface XML APIs

Daniel P. Berrange berrange at redhat.com
Wed Feb 10 14:58:36 UTC 2010


On Wed, Feb 10, 2010 at 03:39:45PM +0100, Daniel Veillard wrote:
> On Wed, Feb 10, 2010 at 01:36:24PM +0000, Daniel P. Berrange wrote:
> > The virConnectPtr is no longer required for error reporting since
> > that is recorded in a thread local. Remove use of virConnectPtr
> > from all APIs in interface_conf.{h,c} and update all callers to
> > match
> > ---
> >  src/conf/interface_conf.c    |  259 ++++++++++++++++++++----------------------
> >  src/conf/interface_conf.h    |   15 +--
> >  src/interface/netcf_driver.c |    8 +-
> >  src/test/test_driver.c       |   16 ++--
> >  tests/interfacexml2xmltest.c |    4 +-
> >  5 files changed, 141 insertions(+), 161 deletions(-)
> > 
> [...]
> > @@ -890,26 +883,24 @@ virInterfaceDefPtr virInterfaceDefParseString(virConnectPtr conn,
> >      if (!pctxt || !pctxt->sax)
> >          goto cleanup;
> >      pctxt->sax->error = catchXMLError;
> > -    pctxt->_private = conn;
> >  
> > -    if (conn) virResetError (&conn->err);
> 
> 
>   Hum, there there is a semantic change, the function used to reset
> the error and not anymore, though it's probably better that way
> 
> 
> > @@ -930,26 +920,24 @@ virInterfaceDefPtr virInterfaceDefParseFile(virConnectPtr conn,
> >      if (!pctxt || !pctxt->sax)
> >          goto cleanup;
> >      pctxt->sax->error = catchXMLError;
> > -    pctxt->_private = conn;
> >  
> > -    if (conn) virResetError (&conn->err);
> 
>   Here too

All the public API methods do a virResetError() before invoking the 
internal drivers, so there really shouldn't be any error present at
this point. Also note that 'conn' has been NULL in at least 50% of
the locations that invoke this method, so I don't think this is worth
worrying about..

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list