So far, this is pure code replacement. But once we introduce
reference counting to virNetworkObj this will be more handy as
there'll be only one function to change: virNetworkObjEndAPI().
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/parallels/parallels_network.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c
index 3c879e4..7618890 100644
--- a/src/parallels/parallels_network.c
+++ b/src/parallels/parallels_network.c
@@ -432,8 +432,7 @@ static virNetworkPtr parallelsNetworkLookupByUUID(virConnectPtr conn,
ret = virGetNetwork(conn, network->def->name, network->def->uuid);
cleanup:
- if (network)
- virObjectUnlock(network);
+ virNetworkObjEndAPI(&network);
return ret;
}
@@ -456,8 +455,7 @@ static virNetworkPtr parallelsNetworkLookupByName(virConnectPtr conn,
ret = virGetNetwork(conn, network->def->name, network->def->uuid);
cleanup:
- if (network)
- virObjectUnlock(network);
+ virNetworkObjEndAPI(&network);
return ret;
}
@@ -483,8 +481,7 @@ static char *parallelsNetworkGetXMLDesc(virNetworkPtr net,
ret = virNetworkDefFormat(network->def, flags);
cleanup:
- if (network)
- virObjectUnlock(network);
+ virNetworkObjEndAPI(&network);
return ret;
}
@@ -504,8 +501,7 @@ static int parallelsNetworkIsActive(virNetworkPtr net)
ret = virNetworkObjIsActive(obj);
cleanup:
- if (obj)
- virObjectUnlock(obj);
+ virNetworkObjEndAPI(&obj);
return ret;
}
@@ -525,8 +521,7 @@ static int parallelsNetworkIsPersistent(virNetworkPtr net)
ret = obj->persistent;
cleanup:
- if (obj)
- virObjectUnlock(obj);
+ virNetworkObjEndAPI(&obj);
return ret;
}
@@ -550,8 +545,7 @@ static int parallelsNetworkGetAutostart(virNetworkPtr net,
ret = 0;
cleanup:
- if (network)
- virObjectUnlock(network);
+ virNetworkObjEndAPI(&network);
return ret;
}
--
2.0.5