From nobody Sat Feb 7 04:40:18 2026 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=1654695832; cv=none; d=zohomail.com; s=zohoarc; b=F86UV9IUDm3GPXuANmjexAiD0LzOa5BddTN9GrTYNWidS627v0Ri5P3SE8gh+/XpEcyx1Y1NXD3Xcd7YSWtqJ6iZaTg0rJAg+A/gWrTNXzf55hvN6Ihm3koXp5Q4PmcTADelM9Dhwp0JJ+/RVM3YbF7JsLG8xTsieUF5M26MLX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654695832; 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=8LZ06g3wUiS5r+nJYfk4FnFWqTjlRT9eRgFTzhpEhP8=; b=jJAiXfT5nq1QJ3cjavRwPurDj720wHMAw1s+T2RYRVJfa8wdsuPtAKBiL/8Dxejc1l4xzwxuamFYIcVhaoxoOBZ/n0/inDXUQFdTiloo3Li9j+0pfNMjzvuMbRPakKlAeaUv6OxS1lp6MAgPmnYh/SQ29nmH3Q0nmUVNjt4qRuY= 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 1654695832618406.6743529986354; Wed, 8 Jun 2022 06:43:52 -0700 (PDT) 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-608-qy03tcJJMkqYTWJRi2-3jw-1; Wed, 08 Jun 2022 09:43:47 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B5FD9185A7BA; Wed, 8 Jun 2022 13:43:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1EB02026D64; Wed, 8 Jun 2022 13:43: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 46C3D1947041; Wed, 8 Jun 2022 13:43:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DED8F1947070 for ; Wed, 8 Jun 2022 13:43:12 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id CFE70492CA3; Wed, 8 Jun 2022 13:43:12 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 784A7492C3B for ; Wed, 8 Jun 2022 13:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654695831; 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=8LZ06g3wUiS5r+nJYfk4FnFWqTjlRT9eRgFTzhpEhP8=; b=is6jGOSqA+hF1tM/UuQCdNwuKF1MxXxfCvXv3tGjj5axo1x4cqJ1w82VbwV4xnTsYFvTtj a7aCLrrIvH6s+s1NcSg5r0l0HL0PudkaBgmwvV2CO0avteqBX0+Bg1apMFahekneXNZ8Uc tdHMGkell2n0k+xM5fVKWZ1EnP8fnzM= X-MC-Unique: qy03tcJJMkqYTWJRi2-3jw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v3 03/15] virDomainIOThreadIDDefArrayInit: Decrease scope of @iothrid Date: Wed, 8 Jun 2022 15:42:57 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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 2.78 on 10.11.54.4 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) X-ZM-MESSAGEID: 1654695834232100001 Content-Type: text/plain; charset="utf-8"; x-default="true" In virDomainIOThreadIDDefArrayInit() the variable @iothrid is used only inside a loop but is declared for whole function. Bring the variable into the loop so that it's obvious that the variable is not used elsewhere. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cc1f765ca9..22b58e3212 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3509,7 +3509,6 @@ virDomainIOThreadIDDefArrayInit(virDomainDef *def, { size_t i; ssize_t nxt =3D -1; - virDomainIOThreadIDDef *iothrid =3D NULL; g_autoptr(virBitmap) thrmap =3D NULL; =20 /* Same value (either 0 or some number), then we have none to fill in = or @@ -3534,6 +3533,8 @@ virDomainIOThreadIDDefArrayInit(virDomainDef *def, =20 /* Populate iothreadids[] using the set bit number from thrmap */ while (def->niothreadids < iothreads) { + g_autoptr(virDomainIOThreadIDDef) iothrid =3D NULL; + if ((nxt =3D virBitmapNextSetBit(thrmap, nxt)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to populate iothreadids")); @@ -3542,7 +3543,7 @@ virDomainIOThreadIDDefArrayInit(virDomainDef *def, iothrid =3D g_new0(virDomainIOThreadIDDef, 1); iothrid->iothread_id =3D nxt; iothrid->autofill =3D true; - def->iothreadids[def->niothreadids++] =3D iothrid; + def->iothreadids[def->niothreadids++] =3D g_steal_pointer(&iothrid= ); } =20 return 0; --=20 2.35.1