pgsql: Avoid type cheats for invalid dsa_handles and dshash_table_handl - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Avoid type cheats for invalid dsa_handles and dshash_table_handl
Date
Msg-id E1pKiwz-005RTp-Q0@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: doc: Fix network_ops -> inet_ops in SpGiST operator class list
Next
From: Andres Freund
Date:
Subject: pgsql: plpython: Avoid the need to redefine *printf macros