network: Modify naming for virNetworkObjList* fetching APIs

Use the structure names in the @data setup - makes it easier than
going back to find the struct fields to make sure the order of the
data is correct.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2017-05-10 08:58:38 -04:00
parent 8473859a47
commit 80ba4142e1
1 changed files with 9 additions and 4 deletions

View File

@ -1342,7 +1342,9 @@ virNetworkObjListExport(virConnectPtr conn,
unsigned int flags)
{
int ret = -1;
struct virNetworkObjListData data = { conn, NULL, filter, flags, 0, false};
struct virNetworkObjListData data = {
.conn = conn, .nets = NULL, .filter = filter, .flags = flags,
.nnets = 0, .error = false };
virObjectLock(netobjs);
if (nets && VIR_ALLOC_N(data.nets, virHashSize(netobjs->objs) + 1) < 0)
@ -1408,7 +1410,8 @@ virNetworkObjListForEach(virNetworkObjListPtr nets,
virNetworkObjListIterator callback,
void *opaque)
{
struct virNetworkObjListForEachHelperData data = {callback, opaque, 0};
struct virNetworkObjListForEachHelperData data = {
.callback = callback, .opaque = opaque, .ret = 0};
virObjectLock(nets);
virHashForEach(nets->objs, virNetworkObjListForEachHelper, &data);
virObjectUnlock(nets);
@ -1474,7 +1477,8 @@ virNetworkObjListGetNames(virNetworkObjListPtr nets,
int ret = -1;
struct virNetworkObjListGetHelperData data = {
conn, filter, names, maxnames, active, 0, false};
.conn = conn, .filter = filter, .names = names,
.maxnames = maxnames, .active = active, .got = 0, .error = false};
virObjectLock(nets);
virHashForEach(nets->objs, virNetworkObjListGetHelper, &data);
@ -1500,7 +1504,8 @@ virNetworkObjListNumOfNetworks(virNetworkObjListPtr nets,
virConnectPtr conn)
{
struct virNetworkObjListGetHelperData data = {
conn, filter, NULL, -1, active, 0, false};
.conn = conn, .filter = filter, .names = NULL,
.maxnames = -1, .active = active, .got = 0, .error = false};
virObjectLock(nets);
virHashForEach(nets->objs, virNetworkObjListGetHelper, &data);