[libvirt] [PATCH v1 08/31] test_driver: s/virNetworkObjList/virNetworkObjListPtr/
Peter Krempa
pkrempa at redhat.com
Thu Feb 26 15:46:26 UTC 2015
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 at redhat.com>
> ---
> 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.
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150226/80e56e89/attachment-0001.sig>
More information about the libvir-list
mailing list