From 323d85610dcbccf00028b9654d4cba90f3ae69a3 Mon Sep 17 00:00:00 2001
From: Sami Imseih <samimseih@gmail.com>
Date: Thu, 26 Mar 2026 18:27:50 +0000
Subject: [PATCH v1 1/1] Rename LWLockNewTrancheId() parameter from "name" to
 "tranche_name"

This makes the parameter naming consistent with GetNamedLWLockTranche(),
which already uses "tranche_name".  Update the function signature in the
header, the implementation in lwlock.c, and the documentation in
xfunc.sgml to match.
---
 doc/src/sgml/xfunc.sgml           | 2 +-
 src/backend/storage/lmgr/lwlock.c | 8 ++++----
 src/include/storage/lwlock.h      | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index 70e815b8a2c..6d464d4d7cf 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -3765,7 +3765,7 @@ LWLockPadded *GetNamedLWLockTranche(const char *tranche_name)
       <literal>shmem_request_hook</literal>.  To do so, first allocate a
       <literal>tranche_id</literal> by calling:
 <programlisting>
-int LWLockNewTrancheId(const char *name)
+int LWLockNewTrancheId(const char *tranche_name)
 </programlisting>
       Next, initialize each LWLock, passing the new
       <literal>tranche_id</literal> as an argument:
diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c
index 49382de88fc..d934ff40f71 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -594,16 +594,16 @@ GetNamedLWLockTranche(const char *tranche_name)
  * Allocate a new tranche ID with the provided name.
  */
 int
-LWLockNewTrancheId(const char *name)
+LWLockNewTrancheId(const char *tranche_name)
 {
 	int			result;
 
-	if (!name)
+	if (!tranche_name)
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_NAME),
 				 errmsg("tranche name cannot be NULL")));
 
-	if (strlen(name) >= NAMEDATALEN)
+	if (strlen(tranche_name) >= NAMEDATALEN)
 		ereport(ERROR,
 				(errcode(ERRCODE_NAME_TOO_LONG),
 				 errmsg("tranche name too long"),
@@ -627,7 +627,7 @@ LWLockNewTrancheId(const char *name)
 
 	result = (*LWLockCounter)++;
 	LocalLWLockCounter = *LWLockCounter;
-	strlcpy(LWLockTrancheNames[result - LWTRANCHE_FIRST_USER_DEFINED], name, NAMEDATALEN);
+	strlcpy(LWLockTrancheNames[result - LWTRANCHE_FIRST_USER_DEFINED], tranche_name, NAMEDATALEN);
 
 	SpinLockRelease(ShmemLock);
 
diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h
index 9a0290391d0..dd5142c10d0 100644
--- a/src/include/storage/lwlock.h
+++ b/src/include/storage/lwlock.h
@@ -155,7 +155,7 @@ extern LWLockPadded *GetNamedLWLockTranche(const char *tranche_name);
  * counter.  Second, LWLockInitialize should be called just once per lwlock,
  * passing the tranche ID as an argument.
  */
-extern int	LWLockNewTrancheId(const char *name);
+extern int	LWLockNewTrancheId(const char *tranche_name);
 extern void LWLockInitialize(LWLock *lock, int tranche_id);
 
 /*
-- 
2.47.3

