---
src/test/test_driver.c | 156 +++++++++++++++++--------------------------------
1 file changed, 52 insertions(+), 104 deletions(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 37756e7..b7d1153 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1710,8 +1710,7 @@ static int testDomainIsActive(virDomainPtr dom)
ret = virDomainObjIsActive(obj);
cleanup:
- if (obj)
- virObjectUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -1731,8 +1730,7 @@ static int testDomainIsPersistent(virDomainPtr dom)
ret = obj->persistent;
cleanup:
- if (obj)
- virObjectUnlock(obj);
+ virObjectUnlock(obj);
return ret;
}
@@ -1781,8 +1779,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
ret->id = dom->def->id;
cleanup:
- if (dom)
- virObjectUnlock(dom);
+ virObjectUnlock(dom);
if (event)
testObjectEventQueue(privconn, event);
virDomainDefFree(def);
@@ -1812,8 +1809,7 @@ static virDomainPtr testDomainLookupByID(virConnectPtr conn,
ret->id = dom->def->id;
cleanup:
- if (dom)
- virObjectUnlock(dom);
+ virObjectUnlock(dom);
return ret;
}
@@ -1838,8 +1834,7 @@ static virDomainPtr testDomainLookupByUUID(virConnectPtr conn,
ret->id = dom->def->id;
cleanup:
- if (dom)
- virObjectUnlock(dom);
+ virObjectUnlock(dom);
return ret;
}
@@ -1864,8 +1859,7 @@ static virDomainPtr testDomainLookupByName(virConnectPtr conn,
ret->id = dom->def->id;
cleanup:
- if (dom)
- virObjectUnlock(dom);
+ virObjectUnlock(dom);
return ret;
}
@@ -1912,8 +1906,7 @@ static int testDomainDestroy(virDomainPtr domain)
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
if (event)
testObjectEventQueue(privconn, event);
testDriverUnlock(privconn);
@@ -1951,8 +1944,7 @@ static int testDomainResume(virDomainPtr domain)
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
if (event) {
testDriverLock(privconn);
testObjectEventQueue(privconn, event);
@@ -1993,8 +1985,7 @@ static int testDomainSuspend(virDomainPtr domain)
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
if (event) {
testDriverLock(privconn);
@@ -2042,8 +2033,7 @@ static int testDomainShutdownFlags(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
if (event)
testObjectEventQueue(privconn, event);
testDriverUnlock(privconn);
@@ -2118,8 +2108,7 @@ static int testDomainReboot(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
if (event)
testObjectEventQueue(privconn, event);
testDriverUnlock(privconn);
@@ -2158,8 +2147,7 @@ static int testDomainGetInfo(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -2189,8 +2177,7 @@ testDomainGetState(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -2290,8 +2277,7 @@ testDomainSaveFlags(virDomainPtr domain, const char *path,
VIR_FORCE_CLOSE(fd);
unlink(path);
}
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
if (event)
testObjectEventQueue(privconn, event);
testDriverUnlock(privconn);
@@ -2396,8 +2382,7 @@ testDomainRestoreFlags(virConnectPtr conn,
virDomainDefFree(def);
VIR_FREE(xml);
VIR_FORCE_CLOSE(fd);
- if (dom)
- virObjectUnlock(dom);
+ virObjectUnlock(dom);
if (event)
testObjectEventQueue(privconn, event);
testDriverUnlock(privconn);
@@ -2474,8 +2459,7 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain,
ret = 0;
cleanup:
VIR_FORCE_CLOSE(fd);
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
if (event)
testObjectEventQueue(privconn, event);
testDriverUnlock(privconn);
@@ -2523,8 +2507,7 @@ testDomainGetMaxMemory(virDomainPtr domain)
ret = privdom->def->mem.max_balloon;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -2550,8 +2533,7 @@ static int testDomainSetMaxMemory(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -2581,8 +2563,7 @@ static int testDomainSetMemory(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -2620,8 +2601,7 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return ret;
}
@@ -2719,8 +2699,7 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
}
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -2814,8 +2793,7 @@ static int testDomainGetVcpus(virDomainPtr domain,
ret = maxinfo;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -2872,8 +2850,7 @@ static int testDomainPinVcpu(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -2903,8 +2880,7 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int
flags)
flags);
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -2977,8 +2953,7 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
cleanup:
virDomainDefFree(def);
virDomainDefFree(oldDef);
- if (dom)
- virObjectUnlock(dom);
+ virObjectUnlock(dom);
if (event)
testObjectEventQueue(privconn, event);
testDriverUnlock(privconn);
@@ -3011,8 +2986,7 @@ static char *testDomainGetMetadata(virDomainPtr dom,
privconn->xmlopt, flags);
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -3045,8 +3019,7 @@ static int testDomainSetMetadata(virDomainPtr dom,
NULL, flags);
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -3115,8 +3088,7 @@ static int testDomainCreateWithFlags(virDomainPtr domain, unsigned
int flags)
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
if (event)
testObjectEventQueue(privconn, event);
testDriverUnlock(privconn);
@@ -3191,8 +3163,7 @@ static int testDomainUndefineFlags(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
if (event)
testObjectEventQueue(privconn, event);
testDriverUnlock(privconn);
@@ -3225,8 +3196,7 @@ static int testDomainGetAutostart(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -3252,8 +3222,7 @@ static int testDomainSetAutostart(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -3302,8 +3271,7 @@ testDomainGetSchedulerParametersFlags(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -3353,8 +3321,7 @@ testDomainSetSchedulerParametersFlags(virDomainPtr domain,
ret = 0;
cleanup:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -3414,8 +3381,7 @@ static int testDomainBlockStats(virDomainPtr domain,
ret = 0;
error:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -3473,8 +3439,7 @@ static int testDomainInterfaceStats(virDomainPtr domain,
ret = 0;
error:
- if (privdom)
- virObjectUnlock(privdom);
+ virObjectUnlock(privdom);
return ret;
}
@@ -6442,8 +6407,7 @@ testDomainManagedSave(virDomainPtr dom, unsigned int flags)
ret = 0;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
if (event) {
testDriverLock(privconn);
testObjectEventQueue(privconn, event);
@@ -6473,8 +6437,7 @@ testDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
ret = vm->hasManagedSave;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
testDriverUnlock(privconn);
return ret;
}
@@ -6499,8 +6462,7 @@ testDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
vm->hasManagedSave = false;
ret = 0;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
testDriverUnlock(privconn);
return ret;
}
@@ -6551,8 +6513,7 @@ testDomainSnapshotNum(virDomainPtr domain, unsigned int flags)
n = virDomainSnapshotObjListNum(vm->snapshots, NULL, flags);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return n;
}
@@ -6575,8 +6536,7 @@ testDomainSnapshotListNames(virDomainPtr domain,
flags);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return n;
}
@@ -6597,8 +6557,7 @@ testDomainListAllSnapshots(virDomainPtr domain,
n = virDomainListSnapshots(vm->snapshots, NULL, domain, snaps, flags);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return n;
}
@@ -6625,8 +6584,7 @@ testDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
flags);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return n;
}
@@ -6650,8 +6608,7 @@ testDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot,
n = virDomainSnapshotObjListNum(vm->snapshots, snap, flags);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return n;
}
@@ -6677,8 +6634,7 @@ testDomainSnapshotListAllChildren(virDomainSnapshotPtr snapshot,
flags);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return n;
}
@@ -6702,8 +6658,7 @@ testDomainSnapshotLookupByName(virDomainPtr domain,
snapshot = virGetDomainSnapshot(domain, snap->def->name);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return snapshot;
}
@@ -6722,8 +6677,7 @@ testDomainHasCurrentSnapshot(virDomainPtr domain,
ret = (vm->current_snapshot != NULL);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return ret;
}
@@ -6753,8 +6707,7 @@ testDomainSnapshotGetParent(virDomainSnapshotPtr snapshot,
parent = virGetDomainSnapshot(snapshot->domain, snap->def->parent);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return parent;
}
@@ -6779,8 +6732,7 @@ testDomainSnapshotCurrent(virDomainPtr domain,
snapshot = virGetDomainSnapshot(domain, vm->current_snapshot->def->name);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return snapshot;
}
@@ -6806,8 +6758,7 @@ testDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
xml = virDomainSnapshotDefFormat(uuidstr, snap->def, flags, 0);
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return xml;
}
@@ -6827,8 +6778,7 @@ testDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
STREQ(snapshot->name, vm->current_snapshot->def->name));
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return ret;
}
@@ -6851,8 +6801,7 @@ testDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
ret = 1;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return ret;
}
@@ -7133,8 +7082,7 @@ testDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
ret = 0;
cleanup:
- if (vm)
- virObjectUnlock(vm);
+ virObjectUnlock(vm);
return ret;
}
--
1.9.0