Subject: [PATCH] libvirt-domain.c:virDomainMigrateCheckNotLocal function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From c013b053d7514ee66b841bc99900b06d1e9d4dfd Mon Sep 17 00:00:00 2001
From: xiajidong <xiajidong@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 Sep 2018 08:04:20 -0400
Subject: [PATCH] libvirt-domain.c:virDomainMigrateCheckNotLocal function
 return bool instead of int type

the function of virDomainMigrateCheckNotLocal return bool should be more in
line with specification,
and use return is better than goto.

Signed-off-by: xiajidong <xiajidong@xxxxxxxxxxxxxxxxxxxx>
---
 src/libvirt-domain.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 7690339..d741261 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -3290,25 +3290,25 @@ virDomainMigrateVersion3Params(virDomainPtr domain,
 }
 
 
-static int
+static bool
 virDomainMigrateCheckNotLocal(const char *dconnuri)
 {
     virURIPtr tempuri = NULL;
-    int ret = -1;
 
-    if (!(tempuri = virURIParse(dconnuri)))
-        goto cleanup;
+    if (!(tempuri = virURIParse(dconnuri))) {
+        virURIFree(tempuri);
+	     return false;
+    }
     if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) {
         virReportInvalidArg(dconnuri, "%s",
                             _("Attempt to migrate guest to the same
host"));
-        goto cleanup;
+        virURIFree(tempuri);
+	     return false;
     }
 
-    ret = 0;
 
- cleanup:
     virURIFree(tempuri);
-    return ret;
+    return ture;
 }
 
 
@@ -3428,7 +3428,7 @@ virDomainMigrateUnmanagedParams(virDomainPtr domain,
     VIR_TYPED_PARAMS_DEBUG(params, nparams);
 
     if ((flags & VIR_MIGRATE_PEER2PEER) &&
-        virDomainMigrateCheckNotLocal(dconnuri) < 0)
+        !virDomainMigrateCheckNotLocal(dconnuri))
         return -1;
 
     if ((flags & VIR_MIGRATE_PEER2PEER) &&
-- 
1.8.3.1




--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux