mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
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
This commit is contained in:
@@ -173,9 +173,8 @@ dsm_postmaster_startup(PGShmemHeader *shim)
|
||||
|
||||
/*
|
||||
* Loop until we find an unused identifier for the new control segment. We
|
||||
* sometimes use 0 as a sentinel value indicating that no control segment
|
||||
* is known to exist, so avoid using that value for a real control
|
||||
* segment.
|
||||
* sometimes use DSM_HANDLE_INVALID as a sentinel value indicating "no
|
||||
* control segment", so avoid generating that value for a real handle.
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
|
Reference in New Issue
Block a user