From nobody Sun Feb 8 18:31:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1611590760; cv=none; d=zohomail.com; s=zohoarc; b=aJdcOUI5uDMnUAuGt4VlKLH2bez4gQQFf77JDvLcMn/wSq5mGv1+Fq+v/XNruudPKJbSVTzryFvDvorizI9EJ4smo8LXndOKVjsimCNEM9dGumw+lXDRwQUrXZMKzR9hxBhIR54DD3Le60ovayNlbfwiH48uVksGwBeWoRg/PCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611590760; 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=GkdHP0/qVQIZkAPMf1NuExvd/TfnQxmLokrjCyIULzI=; b=k4z0TvDn1YiZM/yEHNLz5luZslFCAjEH1iPcInFPW75Q2bRiL1+ddZyiSezNcr6+2O0aFBFurh8Y409QWeKJfs/07Nq9rRb2tXikVarUQzLRuAI4p+H/6Iypx+lq1QZ/Fd7/Nya8qwgljKHuMfSpw/8h43JSnQv2tJ0yqufk30g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611590760689933.3952210717728; Mon, 25 Jan 2021 08:06:00 -0800 (PST) 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-388-4Wcc65lcPjG6fl3MXYOGJw-1; Mon, 25 Jan 2021 11:05:55 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31704107ACF8; Mon, 25 Jan 2021 16:05:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 10EC45C1C5; Mon, 25 Jan 2021 16:05:48 +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 CA23D1809CA6; Mon, 25 Jan 2021 16:05:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10PG5Z5b018237 for ; Mon, 25 Jan 2021 11:05:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id ED0945D9DC; Mon, 25 Jan 2021 16:05:35 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 258635D9DB for ; Mon, 25 Jan 2021 16:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611590759; 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=GkdHP0/qVQIZkAPMf1NuExvd/TfnQxmLokrjCyIULzI=; b=XlmjUUgDJrZKPbqzp/pD2MoxJfzezOOVYsRVpiv30SoIzLxTZmUHvPmwdjHAZj5+dRRhqD lYd1Y3yWYQ6zz8wRD53Dq+5Gd/BXcTtRh3LXTxBfCFXKXe81sIJPkvTq8tJEyIVoW0AF8E hq313k3aXLjGieemtIVutw8ioCUxFsc= X-MC-Unique: 4Wcc65lcPjG6fl3MXYOGJw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/12] virStorageSourceGetMetadata: Refactor cleanup Date: Mon, 25 Jan 2021 17:05:17 +0100 Message-Id: <31928faf8f72b451d5ea0a8ae643dc18e8d8cb2c.1611590679.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" Use g_autoptr for the hash table and remove the 'ret' variable. Signed-off-by: Peter Krempa --- src/storage_file/storage_source.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_s= ource.c index 9d3761f5bd..51f97b13ef 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -1421,17 +1421,13 @@ virStorageSourceGetMetadata(virStorageSourcePtr src, uid_t uid, gid_t gid, bool report_broken) { - GHashTable *cycle =3D NULL; + g_autoptr(GHashTable) cycle =3D virHashNew(NULL); virStorageType actualType =3D virStorageSourceGetActualType(src); - int ret =3D -1; VIR_DEBUG("path=3D%s format=3D%d uid=3D%u gid=3D%u report_broken=3D%d", src->path, src->format, (unsigned int)uid, (unsigned int)gid, report_broken); - if (!(cycle =3D virHashNew(NULL))) - return -1; - if (src->format <=3D VIR_STORAGE_FILE_NONE) { if (actualType =3D=3D VIR_STORAGE_TYPE_DIR) src->format =3D VIR_STORAGE_FILE_DIR; @@ -1439,9 +1435,6 @@ virStorageSourceGetMetadata(virStorageSourcePtr src, src->format =3D VIR_STORAGE_FILE_RAW; } - ret =3D virStorageSourceGetMetadataRecurse(src, src, uid, gid, - report_broken, cycle, 1); - - virHashFree(cycle); - return ret; + return virStorageSourceGetMetadataRecurse(src, src, uid, gid, + report_broken, cycle, 1); } --=20 2.29.2