summaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr/lmgr.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2025-08-29 07:33:50 +0200
committerPeter Eisentraut <peter@eisentraut.org>2025-08-29 07:39:58 +0200
commit991295f387a6a453fe061831bcc36294989fe77b (patch)
tree79077d230c1940102cb8babcb6d69fd4d9d3be33 /src/backend/storage/lmgr/lmgr.c
parent710e6c4301ee3c739a171ea12ed141b1f8df0d93 (diff)
Mark ItemPointer arguments as const in tuple/table lock functions
The functions LockTuple, ConditionalLockTuple, UnlockTuple, and XactLockTableWait take an ItemPointer argument that they do not modify, so the argument can be const-qualified to better convey intent and allow the compiler to enforce immutability. Author: Chao Li <li.evan.chao@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2m9e4rECHBwpRE4%2BGCH%2BpbYZXLh2f4rB1Du5hDfKug%2BOg%40mail.gmail.com
Diffstat (limited to 'src/backend/storage/lmgr/lmgr.c')
-rw-r--r--src/backend/storage/lmgr/lmgr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c
index 3f6bf70bd3c..4798eb79003 100644
--- a/src/backend/storage/lmgr/lmgr.c
+++ b/src/backend/storage/lmgr/lmgr.c
@@ -55,7 +55,7 @@ typedef struct XactLockTableWaitInfo
{
XLTW_Oper oper;
Relation rel;
- ItemPointer ctid;
+ const ItemPointerData *ctid;
} XactLockTableWaitInfo;
static void XactLockTableWaitErrorCb(void *arg);
@@ -559,7 +559,7 @@ UnlockPage(Relation relation, BlockNumber blkno, LOCKMODE lockmode)
* tuple. See heap_lock_tuple before using this!
*/
void
-LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode)
+LockTuple(Relation relation, const ItemPointerData *tid, LOCKMODE lockmode)
{
LOCKTAG tag;
@@ -579,7 +579,7 @@ LockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode)
* Returns true iff the lock was acquired.
*/
bool
-ConditionalLockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode,
+ConditionalLockTuple(Relation relation, const ItemPointerData *tid, LOCKMODE lockmode,
bool logLockFailure)
{
LOCKTAG tag;
@@ -598,7 +598,7 @@ ConditionalLockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode,
* UnlockTuple
*/
void
-UnlockTuple(Relation relation, ItemPointer tid, LOCKMODE lockmode)
+UnlockTuple(Relation relation, const ItemPointerData *tid, LOCKMODE lockmode)
{
LOCKTAG tag;
@@ -660,7 +660,7 @@ XactLockTableDelete(TransactionId xid)
* and if so wait for its parent.
*/
void
-XactLockTableWait(TransactionId xid, Relation rel, ItemPointer ctid,
+XactLockTableWait(TransactionId xid, Relation rel, const ItemPointerData *ctid,
XLTW_Oper oper)
{
LOCKTAG tag;