render / rpms / libvirt

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