Re: Remove unneeded cast in heap_xlog_lock.

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Chao Li <li.evan.chao@gmail.com>
Cc: Kirill Reshke <reshkekirill@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-22T01:41:15Z
Lists: pgsql-hackers
On Fri, Aug 22, 2025 at 9:44 AM Chao Li <li.evan.chao@gmail.com> wrote:
> On Aug 21, 2025, at 22:10, Kirill Reshke <reshkekirill@gmail.com> wrote:
> I was looking at how PostgreSQL handles VM map bits, when I noticed $subj.
> PFA small refactoring patch.

> LGTM. BufferGetPage() returns a “Page” type, and the receiving variable “page” is of “Page” type as well, so the cast is not needed.

If you run 'git grep', you'll find a lot more instances where the
result of BufferGetPage() is explicitly cast to Page.

git grep -rn "(Page) BufferGetPage" | wc -l
69

Although these casts are unnecessary for sure, I'm not sure if it's
worth making the code changes to fix them.

Thanks
Richard



Commits

  1. Remove unneeded casts of BufferGetPage() result