aboutsummaryrefslogtreecommitdiff
path: root/src/include/lib
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-01-25 11:48:38 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2023-01-25 11:48:38 -0500
commit3b4ac33254e1291f0b3c94f1cb770137c418ce2e (patch)
tree9219e24682a484c34c4d2af241db9300be5727cd /src/include/lib
parentd7c4830abb1867ca4fb83add2a5fac558f778b6a (diff)
downloadpostgresql-3b4ac33254e1291f0b3c94f1cb770137c418ce2e.tar.gz
postgresql-3b4ac33254e1291f0b3c94f1cb770137c418ce2e.zip
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
Diffstat (limited to 'src/include/lib')
-rw-r--r--src/include/lib/dshash.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/lib/dshash.h b/src/include/lib/dshash.h
index 152927742e8..ece55521226 100644
--- a/src/include/lib/dshash.h
+++ b/src/include/lib/dshash.h
@@ -23,6 +23,9 @@ typedef struct dshash_table dshash_table;
/* A handle for a dshash_table which can be shared with other processes. */
typedef dsa_pointer dshash_table_handle;
+/* Sentinel value to use for invalid dshash_table handles. */
+#define DSHASH_HANDLE_INVALID ((dshash_table_handle) InvalidDsaPointer)
+
/* The type for hash values. */
typedef uint32 dshash_hash;