From nobody Sun Feb 8 18:31:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1654606448; cv=none; d=zohomail.com; s=zohoarc; b=OROF9Dpf+mOK1StztbG4DCHKYY/Nd8tYuCgvnIAZa0rfOgGkmSi9B2UpxVY6FCNULWqKPqImpqO9TADPX6ox/v9o66qmefMp6P+ZJXSmAyM2rowNP5TZKXCS0fIcPhOksC7jJ9nSwjcyVzTiGoSwcAZNic/kwDZdWaHcBpozrUM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654606448; 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=0ClgMzXhnoc3EPyXG3y8V4auiBVMCioqXVhfrcXzOFw=; b=dytY3RsFG4+HYdtnMpofy1gntPfwSZquUTtaB2KelbfLI6pf0xInqov7WeSchAW4rKEu/lWcJXArzPDwKasSTvK3L/GZaXz0z9z7jCftzY7k8CpoeZl0OUkQFoE2Mq/qCdnw9BQuSy6TGI7V3Ab40OKzxF1+Yon6VpMSlKWgYbI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1654606448070347.4519542770903; Tue, 7 Jun 2022 05:54:08 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-vxinm44rPK61lTTqDHCBJQ-1; Tue, 07 Jun 2022 08:53:07 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5F6F3395B01C; Tue, 7 Jun 2022 12:53:04 +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 4C124C27E92; Tue, 7 Jun 2022 12:53:04 +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 20B371947B94; Tue, 7 Jun 2022 12:53:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9F15C1947B8D for ; Tue, 7 Jun 2022 12:53:03 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 820BA4050C41; Tue, 7 Jun 2022 12:53:03 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.34.246.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DF184050C40 for ; Tue, 7 Jun 2022 12:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654606446; 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=0ClgMzXhnoc3EPyXG3y8V4auiBVMCioqXVhfrcXzOFw=; b=b2NhY/HwIE5m172bHhortYGcHvOr9vSSeVAZWsw/2woz89nyOZ08MNXcePNrulOGSslkct HZyKXOqn22rm+hkKZDglnMAcn/pI4PGTgycmK+j4m9C0n+TWoNWn14X4PIppsnbtlgXO5K 27oorYIuN1AIWAkkH7xDivdQE5KPvds= X-MC-Unique: vxinm44rPK61lTTqDHCBJQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 03/15] virDomainIOThreadIDDefArrayInit: Decrease scope of @iothrid Date: Tue, 7 Jun 2022 14:52:47 +0200 Message-Id: <0928c0fba500fa8deeb8c3194fb500907c7546aa.1654606121.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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.85 on 10.11.54.8 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: 1654606448752100005 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 3b4274e037..eec5941089 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3508,7 +3508,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 @@ -3533,6 +3532,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")); @@ -3541,7 +3542,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