Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQnxj-000t07-02 for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Dec 2025 14:36:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQnxh-00Dh0i-2T for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Dec 2025 14:36:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQnxh-00Dh0a-1V for pgsql-hackers@lists.postgresql.org; Wed, 03 Dec 2025 14:36:09 +0000 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQnxf-002wJm-0o for pgsql-hackers@lists.postgresql.org; Wed, 03 Dec 2025 14:36:08 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 69438EC03AB; Wed, 3 Dec 2025 09:36:07 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 03 Dec 2025 09:36:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm2; t=1764772567; x= 1764858967; bh=F+GPRvJJ8Vlg0Yvss31+BxTIetpcila7Ey+fIijlUKk=; b=E micesn725JBNbY62UWVHmDASnSEucR4AihSNMoDhadNwjxLRCPtIxH54dWWO2rAi ny5pe8aeU3Kn5tlushezcELff54HXiBGFPg1mCGyxszcDA+ugg2ZBBDk940lhD/v 8lgDFWuzotEXkjUgKyw6zPF4r6DWTUKk7ctUt/RfrxmvQtDmm4IykG1XANodLRVP sbK2wHzD4jdHw/Jsjl6vtRj9UC+6Af39FZaMZKIE2/L+JkZljN7HH6B56whlmMC7 ETCvmfsWsZZE3o/XGunDINWN07l1WCogn4g06y6/JQl/sg8otuY+qx2C/9fYGAfI C+fa/9rRhGNBFNJ9jcVRg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1764772567; x=1764858967; bh=F +GPRvJJ8Vlg0Yvss31+BxTIetpcila7Ey+fIijlUKk=; b=ZXbGyTZ4ggBXSqx1N 63ZeyLJqojw340RxNd0NhnidVTuIpiSRn2rQCd2/zXGZ/3SYdVy74jO868DgBibS 0X3mj58YbqmF5ONkD5FaFLwHMG0xq5y6kszOQM93EM6k+KCadV+zB2K0EDn3Enkv ghhoOhNAHGEoZJCesL0Ie9D8et+5pkfMzFET62AlNCzpkYh7NyscB55jzktkT0vA wpK4fz+bc9sz0k7s1EReHlnpx4SMUWnHLHH4B1Yp3tSs7RSITpDjYKQp9RkFBxSr PJpihGd8LdVuHQm90tXK/IR2QTvkQo3meflECE4TWtxEFD7iLNDslEGW0BqtUhHu j0pOw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeftdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh epfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhhoucfj vghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtffrrg htthgvrhhnpeetuedvheffkeevgfeuheevteevkefggedttdeufeeuheduuddthfeffffh jeefffenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsehk uhhrihhlvghmuhdruggvpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuth dprhgtphhtthhopehpvghtvghrsegvihhsvghnthhrrghuthdrohhrghdprhgtphhtthho pehlihdrvghvrghnrdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehsmhhith hhphgsvddvhedtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghk vghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Dec 2025 09:36:06 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1764772565; bh=BRf9t5r6xC7W/m3td+gFUGjCGV3pr269qTZjcMKToAI=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=E8cpAaixOYz6dUA6ehxWN30eNs2R6pjBtx6qUSHo3CdNnVDjY6644wzkStT/Eixym s42RTCX0bYaXHfmr9gg0pcCy3h4yVxDMFKqLDQYYAQT0RfdSPSCimE6Xb1TX8cPlRf tcHI8FqU0So+sVdYi+evAAdgZzfsmZDZBBsbR8Sz6aKulou8S3CcQcVXvk+AtGyikp t+T/+qdROCitycoye2C4zYIwowb8cZ0bh6VCi2xHO2VrSwYECBa+Z3IRICeoUS+aLQ 3h+vq8JlvlTSE3HgUmC+qv5qK+yAjqnT/JiOIhuU5WKijS5Tbimj+Nk9EgNC44Twli iqCl2LuOJpkpw== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 622E07B; Wed, 03 Dec 2025 15:36:05 +0100 (CET) Date: Wed, 3 Dec 2025 15:36:05 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Chao Li Cc: Peter Smith , Peter Eisentraut , Postgres hackers Subject: Re: Cleanup shadows variable warnings, round 1 Message-ID: <202512031432.cpvnk5irwygr@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <94ECEF6E-681B-40DF-8F6B-4CABE4CDB96A@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Dec-03, Chao Li wrote: > Unfortunately that doesn’t work for my compiler (clang on MacOS), > that’s why I renamed “I" to “u”. I think you're missing his point. He's suggesting to change not only this variable, but also the other uses of "i" in this function. I'd also change "unsigned" to "unsigned int", just because I dislike using unadorned "unsigned" as a type name (I know it's a legal type name.) This could be left alone, I guess -- not important. diff --git a/src/backend/backup/basebackup_incremental.c b/src/backend/backup/basebackup_incremental.c index 852ab577045..322d8997400 100644 --- a/src/backend/backup/basebackup_incremental.c +++ b/src/backend/backup/basebackup_incremental.c @@ -270,7 +270,6 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib, ListCell *lc; TimeLineHistoryEntry **tlep; int num_wal_ranges; - int i; bool found_backup_start_tli = false; TimeLineID earliest_wal_range_tli = 0; XLogRecPtr earliest_wal_range_start_lsn = InvalidXLogRecPtr; @@ -312,7 +311,7 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib, */ expectedTLEs = readTimeLineHistory(backup_state->starttli); tlep = palloc0(num_wal_ranges * sizeof(TimeLineHistoryEntry *)); - for (i = 0; i < num_wal_ranges; ++i) + for (int i = 0; i < num_wal_ranges; ++i) { backup_wal_range *range = list_nth(ib->manifest_wal_ranges, i); bool saw_earliest_wal_range_tli = false; @@ -400,7 +399,7 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib, * anything here. However, if there's a problem staring us right in the * face, it's best to report it, so we do. */ - for (i = 0; i < num_wal_ranges; ++i) + for (int i = 0; i < num_wal_ranges; ++i) { backup_wal_range *range = list_nth(ib->manifest_wal_ranges, i); @@ -595,15 +594,14 @@ PrepareForIncrementalBackup(IncrementalBackupInfo *ib, while (1) { - unsigned nblocks; - unsigned i; + unsigned int nblocks; nblocks = BlockRefTableReaderGetBlocks(reader, blocks, BLOCKS_PER_READ); if (nblocks == 0) break; - for (i = 0; i < nblocks; ++i) + for (unsigned int i = 0; i < nblocks; ++i) BlockRefTableMarkBlockModified(ib->brtab, &rlocator, forknum, blocks[i]); } -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/