Re: [PATCH v1 08/31] test_driver: s/virNetworkObjList/virNetworkObjListPtr/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 26, 2015 at 16:46:26 +0100, Peter Krempa wrote:
> On Thu, Feb 26, 2015 at 15:17:17 +0100, Michal Privoznik wrote:
> > In order to hide the object internals (and use just accessors
> > everywhere), lets store a pointer to the object, instead of object
> > itself.
> > 
> > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> > ---
> >  src/test/test_driver.c | 106 ++++++++++++++++++++++++-------------------------
> >  1 file changed, 51 insertions(+), 55 deletions(-)
> > 
> > diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> > index e2da1e2..90df0e7 100644
> > --- a/src/test/test_driver.c
> > +++ b/src/test/test_driver.c
> > @@ -101,7 +101,7 @@ struct _testConn {
> >      virDomainXMLOptionPtr xmlopt;
> >      virNodeInfo nodeInfo;
> >      virDomainObjListPtr domains;
> > -    virNetworkObjList networks;
> > +    virNetworkObjListPtr networks;
> >      virInterfaceObjList ifaces;
> >      bool transaction_running;
> >      virInterfaceObjList backupIfaces;
> > @@ -115,7 +115,7 @@ struct _testConn {
> >      virObjectEventStatePtr eventState;
> >  };
> >  typedef struct _testConn testConn;
> > -typedef struct _testConn *testConnPtr;
> > +typedef testConn *testConnPtr;
> >  
> >  static testConn defaultConn;
> >  static int defaultConnections;
> > @@ -724,7 +724,8 @@ testOpenDefault(virConnectPtr conn)
> >      if (!(privconn->eventState = virObjectEventStateNew()))
> >          goto error;
> >  
> > -    if (!(privconn->domains = virDomainObjListNew()))
> > +    if (!(privconn->domains = virDomainObjListNew()) ||
> > +        VIR_ALLOC(privconn->networks) < 0)
> >          goto error;
> 
> Since you are going to convert the network structure to an objec
> wouldn't it be better to add a constructor for the object right away
> instead of having to do it later once you hide the struct?
> 
> Otherwise looks good.

Fair enough. Patch 19 of this series does the conversion.

ACK

> 
> Peter
> 

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]