virNetworkObjListExport: Pass virNetworkObjListPtr

Instead of copying the whole object onto stack when calling the
function, just pass the pointer to the object and save up some
space on the stack. Moreover, this prepares the code to hide the
virNetworkObjList structure into network_conf.c and use accessors
only.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2015-02-23 15:44:57 +01:00
parent 5b86f9aa1c
commit bbbc7e41e0
5 changed files with 8 additions and 8 deletions

View File

@ -4239,7 +4239,7 @@ virNetworkMatch(virNetworkObjPtr netobj,
int
virNetworkObjListExport(virConnectPtr conn,
virNetworkObjList netobjs,
virNetworkObjListPtr netobjs,
virNetworkPtr **nets,
virNetworkObjListFilter filter,
unsigned int flags)
@ -4250,11 +4250,11 @@ virNetworkObjListExport(virConnectPtr conn,
int ret = -1;
size_t i;
if (nets && VIR_ALLOC_N(tmp_nets, netobjs.count + 1) < 0)
if (nets && VIR_ALLOC_N(tmp_nets, netobjs->count + 1) < 0)
goto cleanup;
for (i = 0; i < netobjs.count; i++) {
virNetworkObjPtr netobj = netobjs.objs[i];
for (i = 0; i < netobjs->count; i++) {
virNetworkObjPtr netobj = netobjs->objs[i];
virNetworkObjLock(netobj);
if ((!filter || filter(conn, netobj->def)) &&
virNetworkMatch(netobj, flags)) {

View File

@ -440,7 +440,7 @@ VIR_ENUM_DECL(virNetworkForward)
VIR_CONNECT_LIST_NETWORKS_FILTERS_AUTOSTART)
int virNetworkObjListExport(virConnectPtr conn,
virNetworkObjList netobjs,
virNetworkObjListPtr netobjs,
virNetworkPtr **nets,
virNetworkObjListFilter filter,
unsigned int flags);

View File

@ -2640,7 +2640,7 @@ networkConnectListAllNetworks(virConnectPtr conn,
goto cleanup;
networkDriverLock();
ret = virNetworkObjListExport(conn, driver->networks, nets,
ret = virNetworkObjListExport(conn, &driver->networks, nets,
virConnectListAllNetworksCheckACL,
flags);
networkDriverUnlock();

View File

@ -449,7 +449,7 @@ static int parallelsConnectListAllNetworks(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1);
parallelsDriverLock(privconn);
ret = virNetworkObjListExport(conn, privconn->networks, nets, NULL, flags);
ret = virNetworkObjListExport(conn, &privconn->networks, nets, NULL, flags);
parallelsDriverUnlock(privconn);
return ret;

View File

@ -3636,7 +3636,7 @@ testConnectListAllNetworks(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_LIST_NETWORKS_FILTERS_ALL, -1);
testDriverLock(privconn);
ret = virNetworkObjListExport(conn, privconn->networks, nets, NULL, flags);
ret = virNetworkObjListExport(conn, &privconn->networks, nets, NULL, flags);
testDriverUnlock(privconn);
return ret;