From nobody Fri Jul 26 23:26:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1678264131; cv=none; d=zohomail.com; s=zohoarc; b=CyfBBMVlOzRc6v4d/3c+itAotpCsaSyTGOWo9pg8MKpQKwTLQBxPaBTWUXyEjLZW6WxnBcb0yeKD3KvJ3i4m/g2xIbe2rm+fPEymCxrwOYAtHO92oPxThI2s/rEVQ4b3T4M3SdP7YeRCxZronyT904n3lO6nxwGXwiKaAUbhQUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678264131; 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=9Amyatz3NZ9c4ULjENRumwHKG5hstpWQdiDbvRZKY1E=; b=lshrR7ZYCeJKoeM5fwPYpEnYJpYAdHL3UgZj7yUgPweookybkJcDkrOp4AcumuBkefhaJFRRC8WhoFK2qe038fIhlxfk0W7O/cCGUSmlsC/u2aR4cedD2DqLI0y3Bk6PkY0iU/onYVH7BgPpsQ5aft+CjhSq850xjo4yI17H+6w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1678264131734655.3677079615276; Wed, 8 Mar 2023 00:28:51 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-42--KIbXnjhOgG6c_PFoeGePw-1; Wed, 08 Mar 2023 03:28:48 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D067855717; Wed, 8 Mar 2023 08:28:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C6ED492B00; Wed, 8 Mar 2023 08:28:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AF2FE1946A49; Wed, 8 Mar 2023 08:28:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9A95419465B2 for ; Wed, 8 Mar 2023 08:28:23 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C4051440E0; Wed, 8 Mar 2023 08:28:23 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65B44440DD for ; Wed, 8 Mar 2023 08:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678264130; 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=9Amyatz3NZ9c4ULjENRumwHKG5hstpWQdiDbvRZKY1E=; b=cYJDIgASeR4YaodOrcDoNwcXvjCxuy1wRToLVDAoSGXsuUDCPu/0xChlY+lwVw3xwe1tQX VKmMSDotEygIKSkM1vo0PqskKxBHgTDn2/3mUpf9f8yFwvctqpEcycVT2vw2V8/14raus4 FRvzxHWHvphjNHt8xSPjUQ1vJNJi4q0= X-MC-Unique: -KIbXnjhOgG6c_PFoeGePw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/4] virSCSIHostFindByPCI: Decrease scope of some variables Date: Wed, 8 Mar 2023 09:28:19 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678264133389100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Inside of virSCSIHostFindByPCI() there're some variables that are used from a while() loop exclusively. Bring their declaration into the loop. Signed-off-by: Michal Privoznik --- src/util/virscsihost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virscsihost.c b/src/util/virscsihost.c index 54ba9ddb9b..c816b21f64 100644 --- a/src/util/virscsihost.c +++ b/src/util/virscsihost.c @@ -95,9 +95,7 @@ virSCSIHostFindByPCI(const char *sysfs_prefix, const char *prefix =3D sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_HOST_P= ATH; struct dirent *entry =3D NULL; g_autoptr(DIR) dir =3D NULL; - char *p =3D NULL; char *ret =3D NULL; - unsigned int read_unique_id; =20 if (virDirOpen(&dir, prefix) < 0) return NULL; @@ -107,6 +105,8 @@ virSCSIHostFindByPCI(const char *sysfs_prefix, g_autofree char *host_path =3D NULL; g_autofree char *unique_path =3D NULL; g_autofree char *buf =3D NULL; + char *p =3D NULL; + unsigned int read_unique_id; =20 if (!virFileIsLink(entry->d_name)) continue; --=20 2.39.2