From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid type cheats for invalid dsa_handles and dshash_table_handl
Date: Wed, 25 Jan 2023 16:48:42 +0000
Message-ID: <E1pKiwz-005RTp-Q0@gemulon.postgresql.org> (raw)
Avoid type cheats for invalid dsa_handles and dshash_table_handles.
Invent separate macros for "invalid" values of these types, so that
we needn't embed knowledge of their representations into calling code.
These are all zeroes anyway ATM, so this is not fixing any live bug,
but it makes the code cleaner and more future-proof.
I (tgl) also chose to move DSM_HANDLE_INVALID into dsm_impl.h,
since it seems like it should live beside the typedef for dsm_handle.
Hou Zhijie, Nathan Bossart, Kyotaro Horiguchi, Tom Lane
Discussion: https://postgr.es/m/OS0PR01MB5716860B1454C34E5B179B6694C99@OS0PR01MB5716.jpnprd01.prod.outlook.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3b4ac33254e1291f0b3c94f1cb770137c418ce2e
Modified Files
--------------
src/backend/replication/logical/launcher.c | 8 ++++----
src/backend/storage/ipc/dsm.c | 5 ++---
src/backend/utils/mmgr/dsa.c | 4 ++--
src/include/lib/dshash.h | 3 +++
src/include/storage/dsm.h | 3 ---
src/include/storage/dsm_impl.h | 3 +++
src/include/utils/dsa.h | 4 ++++
7 files changed, 18 insertions(+), 12 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Avoid type cheats for invalid dsa_handles and dshash_table_handl
In-Reply-To: <E1pKiwz-005RTp-Q0@gemulon.postgresql.org>
References: <E1pKiwz-005RTp-Q0@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox