Remove traces of long in dynahash.c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Remove traces of long in dynahash.c
Date: 2025-08-19 06:24:39
Message-ID: aKQYp-bKTRtRauZ6@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

While looking at the recent business with dynahash.c in [1], I have
been reminded of the fact that this code still depends on long. Based
on my lookup of the code, I don't think that there is any issue with
the current uses, but I've never been a fan of using a type that's 8
byte everywhere except on WIN32, and we have been bitten by that in
the past depending on the code paths where long is used, even if WIN32
should be niche these days.

So I have looked at this file, and finished with the attached. The
result is nice, removing long from hsearch.h, as well as dynahash.c,
cleaning up some variable declarations on the way.

While monitoring the callers of the function signatures updated in
this patch, there is a mix of Size, int or int32 used in the variable
declarations used with the callers. There were a couple of long
declared in a couple of places like pgss, locking, predicate, shmem
that were declared as such to map with dynahash. These can be
replaced.

Thoughts?

[1]: https://www.postgresql.org/message-id/aKF8mPDqgQb3uBjG@paquier.xyz
--
Michael

Attachment Content-Type Size
0001-Replace-uses-of-long-by-uint64-in-dynahash.c-and-hse.patch text/x-diff 16.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2025-08-19 06:26:13 Re: VM corruption on standby
Previous Message Kirill Reshke 2025-08-19 06:17:03 Re: VM corruption on standby