render / rpms / libvirt

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