mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +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);
|
||||
if (obj) {
|
||||
virObjectLock(obj);
|
||||
if (obj->removing) {
|
||||
virObjectUnlock(obj);
|
||||
virObjectUnref(obj);
|
||||
obj = NULL;
|
||||
}
|
||||
if (obj->removing)
|
||||
virDomainObjEndAPI(&obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
@ -165,11 +162,8 @@ virDomainObjListFindByUUID(virDomainObjList *doms,
|
||||
obj = virDomainObjListFindByUUIDLocked(doms, uuid);
|
||||
virObjectRWUnlock(doms);
|
||||
|
||||
if (obj && obj->removing) {
|
||||
virObjectUnlock(obj);
|
||||
virObjectUnref(obj);
|
||||
obj = NULL;
|
||||
}
|
||||
if (obj && obj->removing)
|
||||
virDomainObjEndAPI(&obj);
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -208,11 +202,8 @@ virDomainObjListFindByName(virDomainObjList *doms,
|
||||
obj = virDomainObjListFindByNameLocked(doms, name);
|
||||
virObjectRWUnlock(doms);
|
||||
|
||||
if (obj && obj->removing) {
|
||||
virObjectUnlock(obj);
|
||||
virObjectUnref(obj);
|
||||
obj = NULL;
|
||||
}
|
||||
if (obj && obj->removing)
|
||||
virDomainObjEndAPI(&obj);
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -953,8 +944,7 @@ virDomainObjListFilter(virDomainObj ***list,
|
||||
if (vm->removing ||
|
||||
(filter && !filter(conn, vm->def)) ||
|
||||
!virDomainObjMatchFilter(vm, flags)) {
|
||||
virObjectUnlock(vm);
|
||||
virObjectUnref(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
VIR_DELETE_ELEMENT(*list, i, *nvms);
|
||||
continue;
|
||||
}
|
||||
|
@ -461,8 +461,7 @@ libxlReconnectDomain(virDomainObj *vm,
|
||||
|
||||
cleanup:
|
||||
libxl_dominfo_dispose(&d_info);
|
||||
virObjectUnlock(vm);
|
||||
virObjectUnref(vm);
|
||||
virDomainObjEndAPI(&vm);
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user