mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
Use virDomainObjEndAPI() more
Instead of explicit virObjectUnlock(obj) + virObjectUnref(obj) combo the virDomainObjEndAPI() can be used. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
7f90b137bf
commit
2d5b403cff
@ -119,11 +119,8 @@ virDomainObjListFindByID(virDomainObjList *doms,
|
|||||||
virObjectRWUnlock(doms);
|
virObjectRWUnlock(doms);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
virObjectLock(obj);
|
virObjectLock(obj);
|
||||||
if (obj->removing) {
|
if (obj->removing)
|
||||||
virObjectUnlock(obj);
|
virDomainObjEndAPI(&obj);
|
||||||
virObjectUnref(obj);
|
|
||||||
obj = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
@ -165,11 +162,8 @@ virDomainObjListFindByUUID(virDomainObjList *doms,
|
|||||||
obj = virDomainObjListFindByUUIDLocked(doms, uuid);
|
obj = virDomainObjListFindByUUIDLocked(doms, uuid);
|
||||||
virObjectRWUnlock(doms);
|
virObjectRWUnlock(doms);
|
||||||
|
|
||||||
if (obj && obj->removing) {
|
if (obj && obj->removing)
|
||||||
virObjectUnlock(obj);
|
virDomainObjEndAPI(&obj);
|
||||||
virObjectUnref(obj);
|
|
||||||
obj = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -208,11 +202,8 @@ virDomainObjListFindByName(virDomainObjList *doms,
|
|||||||
obj = virDomainObjListFindByNameLocked(doms, name);
|
obj = virDomainObjListFindByNameLocked(doms, name);
|
||||||
virObjectRWUnlock(doms);
|
virObjectRWUnlock(doms);
|
||||||
|
|
||||||
if (obj && obj->removing) {
|
if (obj && obj->removing)
|
||||||
virObjectUnlock(obj);
|
virDomainObjEndAPI(&obj);
|
||||||
virObjectUnref(obj);
|
|
||||||
obj = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -953,8 +944,7 @@ virDomainObjListFilter(virDomainObj ***list,
|
|||||||
if (vm->removing ||
|
if (vm->removing ||
|
||||||
(filter && !filter(conn, vm->def)) ||
|
(filter && !filter(conn, vm->def)) ||
|
||||||
!virDomainObjMatchFilter(vm, flags)) {
|
!virDomainObjMatchFilter(vm, flags)) {
|
||||||
virObjectUnlock(vm);
|
virDomainObjEndAPI(&vm);
|
||||||
virObjectUnref(vm);
|
|
||||||
VIR_DELETE_ELEMENT(*list, i, *nvms);
|
VIR_DELETE_ELEMENT(*list, i, *nvms);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -461,8 +461,7 @@ libxlReconnectDomain(virDomainObj *vm,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
libxl_dominfo_dispose(&d_info);
|
libxl_dominfo_dispose(&d_info);
|
||||||
virObjectUnlock(vm);
|
virDomainObjEndAPI(&vm);
|
||||||
virObjectUnref(vm);
|
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user