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.94.2) (envelope-from ) id 1tmCtp-004xEJ-5j for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Feb 2025 14:24:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tmCto-00AZg2-5A for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Feb 2025 14:24:04 +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.94.2) (envelope-from ) id 1tmCtm-00AZft-SO for pgsql-hackers@lists.postgresql.org; Sun, 23 Feb 2025 14:24:03 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tmCtj-000JNT-1C for pgsql-hackers@postgresql.org; Sun, 23 Feb 2025 14:24:01 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.stl.internal (Postfix) with ESMTP id 91AEF1140162; Sun, 23 Feb 2025 09:23:59 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Sun, 23 Feb 2025 09:23:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm3; t=1740320639; x=1740407039; bh=01sSlxH7VgMXyOkvrwGJ0yZnKaAXLoUG vcEt57jv7jw=; b=fKtL2cf5D3d0XC6/khoCVSjMuEl8olydvVZftQzNaMaOJReF W7mBdMs3mLhIZLi6V+hQcYczYxJ7eI9V6YljgSR09CpGa4dUn+NOCsUGZ0WIt8DL 40DLjeFPokNs6IBAl9HqMqjGTbFtpEgK0xKLWM+TGLp/N499cbin58xAIHzEoiy/ J1/3UvshQsrsQ0o7WCbFS8xO0VNW2we2oPf2ebOnpqJ3x03dlpbBEEC+wW3fKbtv X2Famcjn5um8YheO8VbmF49XCd5c7Mtjhw8fOSlWWKUKarmr8n39xp2ZNtO8Fd0f xrlx0PsIrmEnZDyuwFAOUWZh14Zu/3IyD7zEkA== 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 :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1740320639; x= 1740407039; bh=01sSlxH7VgMXyOkvrwGJ0yZnKaAXLoUGvcEt57jv7jw=; b=w IUPDg0oqdOBVajONPF3ioKQW79L4oj/JhVTIsAuRNX1jXZHaejUkqrbMPm51d9vQ 4QyRmjZxiTfbRpPrVc8qAIf5sQYy2q8g03fKBVWLD+U2dTIGM1hkdyOAQcR0ACTz bpIZCgwbYMWZ30xpX07QQ/+QTk8bug6P9Q9E0IcFacZSBugQuRdT2xVjuhYAuShO aFwAD1bL97e+M68IdoGWYW14G12vjhSgC+fdyRagK0wcQMHvw/Jf6WfsKz3f28K7 PU07IghbPDyq16ldh0swbNZywzeqSBCsFdZe1dG2u3oWsU0kW8mAr0dkEpbejVEz ErRxa3DRHoZmqmAGYmO+w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdejiedtjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddv jeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhesvghish gvnhhtrhgruhhtrdhorhhgqeenucggtffrrghtthgvrhhnpeejhfevhedttefgfffhhfef fefggffhffelgfeiueeukeehvdehvdefheffvdefueenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrsegvihhsvghnthhrrghuthdr ohhrghdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoh epihhlmhgrrhhisehilhhmrghrihdrohhrghdprhgtphhtthhopehpghhsqhhlqdhhrggt khgvrhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 23 Feb 2025 09:23:58 -0500 (EST) Message-ID: <108db65b-1ed2-4c13-8ac3-034998bdbe34@eisentraut.org> Date: Sun, 23 Feb 2025 15:23:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Remove useless casts to (char *) To: =?UTF-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= Cc: pgsql-hackers References: <87seor2t03.fsf@wibble.ilmari.org> <87jz9x3db1.fsf@wibble.ilmari.org> Content-Language: en-US From: Peter Eisentraut In-Reply-To: <87jz9x3db1.fsf@wibble.ilmari.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I have committed the rest of this with the adjustments you suggested. On 10.02.25 18:44, Dagfinn Ilmari Mannsåker wrote: >> Here is a new patch set rebased over that. > > I had a more thorough read-through this time (as well as applying and > building it), and it does make the code a lot more readable. > > I noticed you in some places added extra parens around remaining casts > with offset additions, e.g. > > - XLogRegisterData((char *) old_key_tuple->t_data + SizeofHeapTupleHeader, > + XLogRegisterData(((char *) old_key_tuple->t_data) + SizeofHeapTupleHeader, > old_key_tuple->t_len - SizeofHeapTupleHeader); > > But not in others: > > - memcpy((char *) tuple->t_data + SizeofHeapTupleHeader, > - (char *) data, > - datalen); > + memcpy((char *) tuple->t_data + SizeofHeapTupleHeader, data, datalen); > > > I don't have a particularly strong opinion either way (maybe -0.2 on the > extra parens), but I mainly think we should keep it consistent, and not > change it gratuitously. > > Greppig indicates to me that the paren-less version is more common: > > $ git grep -P '\(\w+\s*\**\) [\w>-]+ \+ \w+' | wc -l > 283 > $ git grep -P '\(\(\w+\s*\**\) [\w>-]+\) \+ \w+' | wc -l > 96 > > So I think we should leave them as they are. > > - ilmari > >