From nobody Mon Feb 9 00:07:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584987166; cv=none; d=zohomail.com; s=zohoarc; b=b1gSE71IH7sxXsF0XXCEgkx24SVGkZtxXEe5RaH3oVGbAgemjZ8N9zs5IhVEqTLMw5c9tccDeJgf5MtyYoD3MCfXRPx0Cvwif77bv3pGqW4l3Wh1Ky0a8/WDS0zdvPE66zJ6ZlRU1p4xdwYNJRlYfHI0mStNuiQ0651H7PnvMQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584987166; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d0X/7KfUWhNnX6KjVRvaYqPsYHmSfj/KTuoBUMejE6o=; b=kxpGcruRtpmOOIf1Xekj0DFTfdailKeHCm+RFoJIOPvXYKpgj2MX7basIldADBiD14RftN4+kgnvec7/f4mO0qB6vtfjSpsWveJg8bvol1ryE1iMC+52yryUCRnvPjHGmuOpDMXGPSbv0IrW8f89+0Qc6s1Drs7SAG+Rz9A6lDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1584987166723675.4029032209774; Mon, 23 Mar 2020 11:12:46 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-272-1nh7H1UNOd-wWKuBjuF98Q-1; Mon, 23 Mar 2020 14:12:43 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92D23800D5E; Mon, 23 Mar 2020 18:12:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A7925DA83; Mon, 23 Mar 2020 18:12:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1D73F86386; Mon, 23 Mar 2020 18:12:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02NICGbk009497 for ; Mon, 23 Mar 2020 14:12:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id B94418D574; Mon, 23 Mar 2020 18:12:16 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 400F19B93A for ; Mon, 23 Mar 2020 18:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584987165; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=d0X/7KfUWhNnX6KjVRvaYqPsYHmSfj/KTuoBUMejE6o=; b=S8LB+j3NXPvvBKY2hnRLetAvxdz7MxmVT815h3XvJEt6iqnXJ1s5RX7DmEk9pWPnOLxwDX rJcatifq/OZZTX9GZtI1oTPHWojXiHyEDfW3M805YC6Hxx+jL7FXiY5aQjpjoKA0FJTX9g jbjjngibA+6Q5EOxWqmvyhSz/7wXhP0= X-MC-Unique: 1nh7H1UNOd-wWKuBjuF98Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/14] qemuBlockGetBackingStoreString: Remove 'ret' variable Date: Mon, 23 Mar 2020 19:11:59 +0100 Message-Id: <98cff06f42befd90c2b3b624ed89d77c2f171178.1584986997.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We can return the appropriate string directly. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index d6cc999a43..b7c3ba7530 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2043,13 +2043,10 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr = src, virJSONValuePtr props =3D NULL; g_autoptr(virURI) uri =3D NULL; g_autofree char *backingJSON =3D NULL; - char *ret =3D NULL; if (!src->sliceStorage) { - if (virStorageSourceIsLocalStorage(src)) { - ret =3D g_strdup(src->path); - return ret; - } + if (virStorageSourceIsLocalStorage(src)) + return g_strdup(src->path); /* generate simplified URIs for the easy cases */ if (actualType =3D=3D VIR_STORAGE_TYPE_NETWORK && @@ -2068,10 +2065,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr s= rc, if (!(uri =3D qemuBlockStorageSourceGetURI(src))) return NULL; - if (!(ret =3D virURIFormat(uri))) - return NULL; - - return ret; + return virURIFormat(uri); case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG: case VIR_STORAGE_NET_PROTOCOL_RBD: @@ -2105,9 +2099,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr sr= c, if (!(backingJSON =3D virJSONValueToString(props, pretty))) return NULL; - ret =3D g_strdup_printf("json:%s", backingJSON); - - return ret; + return g_strdup_printf("json:%s", backingJSON); } --=20 2.24.1