提交 107c9a56 编写于 作者: M Michal Privoznik

test_driver: Use virNetworkObjEndAPI

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: NMichal Privoznik <mprivozn@redhat.com>
上级 37c2bad7
...@@ -3507,8 +3507,7 @@ static virNetworkPtr testNetworkLookupByUUID(virConnectPtr conn, ...@@ -3507,8 +3507,7 @@ static virNetworkPtr testNetworkLookupByUUID(virConnectPtr conn,
ret = virGetNetwork(conn, net->def->name, net->def->uuid); ret = virGetNetwork(conn, net->def->name, net->def->uuid);
cleanup: cleanup:
if (net) virNetworkObjEndAPI(&net);
virObjectUnlock(net);
return ret; return ret;
} }
...@@ -3531,8 +3530,7 @@ static virNetworkPtr testNetworkLookupByName(virConnectPtr conn, ...@@ -3531,8 +3530,7 @@ static virNetworkPtr testNetworkLookupByName(virConnectPtr conn,
ret = virGetNetwork(conn, net->def->name, net->def->uuid); ret = virGetNetwork(conn, net->def->name, net->def->uuid);
cleanup: cleanup:
if (net) virNetworkObjEndAPI(&net);
virObjectUnlock(net);
return ret; return ret;
} }
...@@ -3620,8 +3618,7 @@ static int testNetworkIsActive(virNetworkPtr net) ...@@ -3620,8 +3618,7 @@ static int testNetworkIsActive(virNetworkPtr net)
ret = virNetworkObjIsActive(obj); ret = virNetworkObjIsActive(obj);
cleanup: cleanup:
if (obj) virNetworkObjEndAPI(&obj);
virObjectUnlock(obj);
return ret; return ret;
} }
...@@ -3641,8 +3638,7 @@ static int testNetworkIsPersistent(virNetworkPtr net) ...@@ -3641,8 +3638,7 @@ static int testNetworkIsPersistent(virNetworkPtr net)
ret = obj->persistent; ret = obj->persistent;
cleanup: cleanup:
if (obj) virNetworkObjEndAPI(&obj);
virObjectUnlock(obj);
return ret; return ret;
} }
...@@ -3674,8 +3670,7 @@ static virNetworkPtr testNetworkCreateXML(virConnectPtr conn, const char *xml) ...@@ -3674,8 +3670,7 @@ static virNetworkPtr testNetworkCreateXML(virConnectPtr conn, const char *xml)
virNetworkDefFree(def); virNetworkDefFree(def);
if (event) if (event)
testObjectEventQueue(privconn, event); testObjectEventQueue(privconn, event);
if (net) virNetworkObjEndAPI(&net);
virObjectUnlock(net);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return ret; return ret;
} }
...@@ -3707,8 +3702,7 @@ virNetworkPtr testNetworkDefineXML(virConnectPtr conn, const char *xml) ...@@ -3707,8 +3702,7 @@ virNetworkPtr testNetworkDefineXML(virConnectPtr conn, const char *xml)
virNetworkDefFree(def); virNetworkDefFree(def);
if (event) if (event)
testObjectEventQueue(privconn, event); testObjectEventQueue(privconn, event);
if (net) virNetworkObjEndAPI(&net);
virObjectUnlock(net);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return ret; return ret;
} }
...@@ -3745,8 +3739,7 @@ static int testNetworkUndefine(virNetworkPtr network) ...@@ -3745,8 +3739,7 @@ static int testNetworkUndefine(virNetworkPtr network)
cleanup: cleanup:
if (event) if (event)
testObjectEventQueue(privconn, event); testObjectEventQueue(privconn, event);
if (privnet) virNetworkObjEndAPI(&privnet);
virObjectUnlock(privnet);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return ret; return ret;
} }
...@@ -3795,8 +3788,7 @@ testNetworkUpdate(virNetworkPtr net, ...@@ -3795,8 +3788,7 @@ testNetworkUpdate(virNetworkPtr net,
ret = 0; ret = 0;
cleanup: cleanup:
if (network) virNetworkObjEndAPI(&network);
virObjectUnlock(network);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return ret; return ret;
} }
...@@ -3832,8 +3824,7 @@ static int testNetworkCreate(virNetworkPtr network) ...@@ -3832,8 +3824,7 @@ static int testNetworkCreate(virNetworkPtr network)
cleanup: cleanup:
if (event) if (event)
testObjectEventQueue(privconn, event); testObjectEventQueue(privconn, event);
if (privnet) virNetworkObjEndAPI(&privnet);
virObjectUnlock(privnet);
return ret; return ret;
} }
...@@ -3865,8 +3856,7 @@ static int testNetworkDestroy(virNetworkPtr network) ...@@ -3865,8 +3856,7 @@ static int testNetworkDestroy(virNetworkPtr network)
cleanup: cleanup:
if (event) if (event)
testObjectEventQueue(privconn, event); testObjectEventQueue(privconn, event);
if (privnet) virNetworkObjEndAPI(&privnet);
virObjectUnlock(privnet);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return ret; return ret;
} }
...@@ -3892,8 +3882,7 @@ static char *testNetworkGetXMLDesc(virNetworkPtr network, ...@@ -3892,8 +3882,7 @@ static char *testNetworkGetXMLDesc(virNetworkPtr network,
ret = virNetworkDefFormat(privnet->def, flags); ret = virNetworkDefFormat(privnet->def, flags);
cleanup: cleanup:
if (privnet) virNetworkObjEndAPI(&privnet);
virObjectUnlock(privnet);
return ret; return ret;
} }
...@@ -3921,8 +3910,7 @@ static char *testNetworkGetBridgeName(virNetworkPtr network) { ...@@ -3921,8 +3910,7 @@ static char *testNetworkGetBridgeName(virNetworkPtr network) {
ignore_value(VIR_STRDUP(bridge, privnet->def->bridge)); ignore_value(VIR_STRDUP(bridge, privnet->def->bridge));
cleanup: cleanup:
if (privnet) virNetworkObjEndAPI(&privnet);
virObjectUnlock(privnet);
return bridge; return bridge;
} }
...@@ -3946,8 +3934,7 @@ static int testNetworkGetAutostart(virNetworkPtr network, ...@@ -3946,8 +3934,7 @@ static int testNetworkGetAutostart(virNetworkPtr network,
ret = 0; ret = 0;
cleanup: cleanup:
if (privnet) virNetworkObjEndAPI(&privnet);
virObjectUnlock(privnet);
return ret; return ret;
} }
...@@ -3971,8 +3958,7 @@ static int testNetworkSetAutostart(virNetworkPtr network, ...@@ -3971,8 +3958,7 @@ static int testNetworkSetAutostart(virNetworkPtr network,
ret = 0; ret = 0;
cleanup: cleanup:
if (privnet) virNetworkObjEndAPI(&privnet);
virObjectUnlock(privnet);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册