render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
d76c62
From 11ec875ccebe3035bb4b6e38406f22d52ed4b7fe Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <11ec875ccebe3035bb4b6e38406f22d52ed4b7fe@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Tue, 24 Mar 2020 16:26:03 +0100
d76c62
Subject: [PATCH] qemuBlockGetBackingStoreString: Remove 'ret' variable
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
We can return the appropriate string directly.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
d76c62
(cherry picked from commit c60fe3106e8b91478e54129b4b1b81cc0543399e)
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1804617
d76c62
Message-Id: <b3cb9b35035b7e2d3de21de3f067966de5e6765b.1585063415.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_block.c | 16 ++++------------
d76c62
 1 file changed, 4 insertions(+), 12 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
d76c62
index 279b4a38b8..20579ec7b3 100644
d76c62
--- a/src/qemu/qemu_block.c
d76c62
+++ b/src/qemu/qemu_block.c
d76c62
@@ -2030,13 +2030,10 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src,
d76c62
     virJSONValuePtr props = NULL;
d76c62
     g_autoptr(virURI) uri = NULL;
d76c62
     g_autofree char *backingJSON = NULL;
d76c62
-    char *ret = NULL;
d76c62
 
d76c62
     if (!src->sliceStorage) {
d76c62
-        if (virStorageSourceIsLocalStorage(src)) {
d76c62
-            ret = g_strdup(src->path);
d76c62
-            return ret;
d76c62
-        }
d76c62
+        if (virStorageSourceIsLocalStorage(src))
d76c62
+            return g_strdup(src->path);
d76c62
 
d76c62
         /* generate simplified URIs for the easy cases */
d76c62
         if (actualType == VIR_STORAGE_TYPE_NETWORK &&
d76c62
@@ -2055,10 +2052,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src,
d76c62
                 if (!(uri = qemuBlockStorageSourceGetURI(src)))
d76c62
                     return NULL;
d76c62
 
d76c62
-                if (!(ret = virURIFormat(uri)))
d76c62
-                    return NULL;
d76c62
-
d76c62
-                return ret;
d76c62
+                return virURIFormat(uri);
d76c62
 
d76c62
             case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
d76c62
             case VIR_STORAGE_NET_PROTOCOL_RBD:
d76c62
@@ -2092,9 +2086,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src,
d76c62
     if (!(backingJSON = virJSONValueToString(props, pretty)))
d76c62
         return NULL;
d76c62
 
d76c62
-    ret = g_strdup_printf("json:%s", backingJSON);
d76c62
-
d76c62
-    return ret;
d76c62
+    return g_strdup_printf("json:%s", backingJSON);
d76c62
 }
d76c62
 
d76c62
 
d76c62
-- 
d76c62
2.26.0
d76c62