mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
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:
parent
5b86f9aa1c
commit
bbbc7e41e0
@ -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)) {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user