Instead of each API copying the same lines of code, lets use the
generic function designed just for that purpose.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/parallels/parallels_sdk.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index 59ca62e..d54f894 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -1838,11 +1838,8 @@ prlsdkDomainChangeState(virDomainPtr domain,
virDomainObjPtr dom;
int ret = -1;
- dom = virDomainObjListFindByUUID(privconn->domains, domain->uuid);
- if (dom == NULL) {
- parallelsDomNotFoundError(domain);
+ if (!(dom = parallelsDomObjFromDomain(domain)))
return -1;
- }
ret = prlsdkDomainChangeStateLocked(privconn, dom, chstate);
virObjectUnlock(dom);
--
2.0.5