| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Remove useless casting to the same type |
| Date: | 2025-12-02 09:25:54 |
| Message-ID: | 6eb9f126-9f21-4740-8677-c45bd8b8a5b6@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 24.11.25 11:26, Bertrand Drouvot wrote:
> Hi hackers,
>
> Attached is a patch to $SUBJECT.
>
> This is the same kind of idea as 7f798aca1d5 and ef8fe693606, as their presence
> could cause risks of hiding actual type mismatches in the future or silently
> discarding qualifiers. I think that it also improves readability.
>
> Those have been found with a coccinelle script as:
>
> "
> @@
> type T;
> T E;
> @@
>
> - (T)
> E
> "
>
> which removes casts when it's casting to the same type.
>
> Note that it generated more that what is in the attached. I chose not to remove
> some of them (mainly arithmetic ones) to keep the patch focused on what matters
> here.
Committed. I made some cosmetic adjustments, to remove line breaks that
are no longer necessary with the shortened lines, and in gbt_num_union()
I kept &out[0] (instead of just out) for consistency with the following
line.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2025-12-02 09:27:41 | Re: [PATCH] Add hint for misspelled relations |
| Previous Message | Amit Kapila | 2025-12-02 09:17:42 | Re: Proposal: Conflict log history table for Logical Replication |