1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Harmonize parameter names in storage and AM code.

Make sure that function declarations use names that exactly match the
corresponding names from function definitions in storage, catalog,
access method, executor, and logical replication code, as well as in
miscellaneous utility/library code.

Like other recent commits that cleaned up function parameter names, this
commit was written with help from clang-tidy.  Later commits will do the
same for other parts of the codebase.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
This commit is contained in:
Peter Geoghegan
2022-09-19 19:18:36 -07:00
parent c47885bd8b
commit bfcf1b3480
80 changed files with 228 additions and 218 deletions

View File

@@ -459,7 +459,7 @@ ForgetPrivateRefCountEntry(PrivateRefCountEntry *ref)
)
static Buffer ReadBuffer_common(SMgrRelation reln, char relpersistence,
static Buffer ReadBuffer_common(SMgrRelation smgr, char relpersistence,
ForkNumber forkNum, BlockNumber blockNum,
ReadBufferMode mode, BufferAccessStrategy strategy,
bool *hit);
@@ -493,7 +493,7 @@ static void RelationCopyStorageUsingBuffer(RelFileLocator srclocator,
static void AtProcExit_Buffers(int code, Datum arg);
static void CheckForBufferLeaks(void);
static int rlocator_comparator(const void *p1, const void *p2);
static inline int buffertag_comparator(const BufferTag *a, const BufferTag *b);
static inline int buffertag_comparator(const BufferTag *ba, const BufferTag *bb);
static inline int ckpt_buforder_comparator(const CkptSortItem *a, const CkptSortItem *b);
static int ts_ckpt_progress_comparator(Datum a, Datum b, void *arg);

View File

@@ -104,7 +104,7 @@ static void extendBufFile(BufFile *file);
static void BufFileLoadBuffer(BufFile *file);
static void BufFileDumpBuffer(BufFile *file);
static void BufFileFlush(BufFile *file);
static File MakeNewFileSetSegment(BufFile *file, int segment);
static File MakeNewFileSetSegment(BufFile *buffile, int segment);
/*
* Create BufFile and perform the common initialization.

View File

@@ -111,7 +111,7 @@ static int fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot,
static BlockNumber fsm_search(Relation rel, uint8 min_cat);
static uint8 fsm_vacuum_page(Relation rel, FSMAddress addr,
BlockNumber start, BlockNumber end,
bool *eof);
bool *eof_p);
/******** Public API ********/

View File

@@ -1045,7 +1045,7 @@ dsm_unpin_segment(dsm_handle handle)
* Find an existing mapping for a shared memory segment, if there is one.
*/
dsm_segment *
dsm_find_mapping(dsm_handle h)
dsm_find_mapping(dsm_handle handle)
{
dlist_iter iter;
dsm_segment *seg;
@@ -1053,7 +1053,7 @@ dsm_find_mapping(dsm_handle h)
dlist_foreach(iter, &dsm_segment_list)
{
seg = dlist_container(dsm_segment, node, iter.cur);
if (seg->handle == h)
if (seg->handle == handle)
return seg;
}

View File

@@ -343,7 +343,7 @@ static bool KnownAssignedXidExists(TransactionId xid);
static void KnownAssignedXidsRemove(TransactionId xid);
static void KnownAssignedXidsRemoveTree(TransactionId xid, int nsubxids,
TransactionId *subxids);
static void KnownAssignedXidsRemovePreceding(TransactionId xid);
static void KnownAssignedXidsRemovePreceding(TransactionId removeXid);
static int KnownAssignedXidsGet(TransactionId *xarray, TransactionId xmax);
static int KnownAssignedXidsGetAndSetXmin(TransactionId *xarray,
TransactionId *xmin,

View File

@@ -1913,13 +1913,13 @@ LWLockReleaseAll(void)
* This is meant as debug support only.
*/
bool
LWLockHeldByMe(LWLock *l)
LWLockHeldByMe(LWLock *lock)
{
int i;
for (i = 0; i < num_held_lwlocks; i++)
{
if (held_lwlocks[i].lock == l)
if (held_lwlocks[i].lock == lock)
return true;
}
return false;
@@ -1931,14 +1931,14 @@ LWLockHeldByMe(LWLock *l)
* This is meant as debug support only.
*/
bool
LWLockAnyHeldByMe(LWLock *l, int nlocks, size_t stride)
LWLockAnyHeldByMe(LWLock *lock, int nlocks, size_t stride)
{
char *held_lock_addr;
char *begin;
char *end;
int i;
begin = (char *) l;
begin = (char *) lock;
end = begin + nlocks * stride;
for (i = 0; i < num_held_lwlocks; i++)
{
@@ -1957,13 +1957,13 @@ LWLockAnyHeldByMe(LWLock *l, int nlocks, size_t stride)
* This is meant as debug support only.
*/
bool
LWLockHeldByMeInMode(LWLock *l, LWLockMode mode)
LWLockHeldByMeInMode(LWLock *lock, LWLockMode mode)
{
int i;
for (i = 0; i < num_held_lwlocks; i++)
{
if (held_lwlocks[i].lock == l && held_lwlocks[i].mode == mode)
if (held_lwlocks[i].lock == lock && held_lwlocks[i].mode == mode)
return true;
}
return false;

View File

@@ -446,7 +446,7 @@ static void SerialSetActiveSerXmin(TransactionId xid);
static uint32 predicatelock_hash(const void *key, Size keysize);
static void SummarizeOldestCommittedSxact(void);
static Snapshot GetSafeSnapshot(Snapshot snapshot);
static Snapshot GetSafeSnapshot(Snapshot origSnapshot);
static Snapshot GetSerializableTransactionSnapshotInt(Snapshot snapshot,
VirtualTransactionId *sourcevxid,
int sourcepid);

View File

@@ -121,7 +121,7 @@ static MemoryContext MdCxt; /* context for all MdfdVec objects */
/* local routines */
static void mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forkNum,
static void mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forknum,
bool isRedo);
static MdfdVec *mdopenfork(SMgrRelation reln, ForkNumber forknum, int behavior);
static void register_dirty_segment(SMgrRelation reln, ForkNumber forknum,
@@ -135,9 +135,9 @@ static void _fdvec_resize(SMgrRelation reln,
int nseg);
static char *_mdfd_segpath(SMgrRelation reln, ForkNumber forknum,
BlockNumber segno);
static MdfdVec *_mdfd_openseg(SMgrRelation reln, ForkNumber forkno,
static MdfdVec *_mdfd_openseg(SMgrRelation reln, ForkNumber forknum,
BlockNumber segno, int oflags);
static MdfdVec *_mdfd_getseg(SMgrRelation reln, ForkNumber forkno,
static MdfdVec *_mdfd_getseg(SMgrRelation reln, ForkNumber forknum,
BlockNumber blkno, bool skipFsync, int behavior);
static BlockNumber _mdnblocks(SMgrRelation reln, ForkNumber forknum,
MdfdVec *seg);
@@ -160,7 +160,7 @@ mdinit(void)
* Note: this will return true for lingering files, with pending deletions
*/
bool
mdexists(SMgrRelation reln, ForkNumber forkNum)
mdexists(SMgrRelation reln, ForkNumber forknum)
{
/*
* Close it first, to ensure that we notice if the fork has been unlinked
@@ -168,9 +168,9 @@ mdexists(SMgrRelation reln, ForkNumber forkNum)
* which already closes relations when dropping them.
*/
if (!InRecovery)
mdclose(reln, forkNum);
mdclose(reln, forknum);
return (mdopenfork(reln, forkNum, EXTENSION_RETURN_NULL) != NULL);
return (mdopenfork(reln, forknum, EXTENSION_RETURN_NULL) != NULL);
}
/*
@@ -179,16 +179,16 @@ mdexists(SMgrRelation reln, ForkNumber forkNum)
* If isRedo is true, it's okay for the relation to exist already.
*/
void
mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo)
{
MdfdVec *mdfd;
char *path;
File fd;
if (isRedo && reln->md_num_open_segs[forkNum] > 0)
if (isRedo && reln->md_num_open_segs[forknum] > 0)
return; /* created and opened already... */
Assert(reln->md_num_open_segs[forkNum] == 0);
Assert(reln->md_num_open_segs[forknum] == 0);
/*
* We may be using the target table space for the first time in this
@@ -203,7 +203,7 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
reln->smgr_rlocator.locator.dbOid,
isRedo);
path = relpath(reln->smgr_rlocator, forkNum);
path = relpath(reln->smgr_rlocator, forknum);
fd = PathNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY);
@@ -225,8 +225,8 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
pfree(path);
_fdvec_resize(reln, forkNum, 1);
mdfd = &reln->md_seg_fds[forkNum][0];
_fdvec_resize(reln, forknum, 1);
mdfd = &reln->md_seg_fds[forknum][0];
mdfd->mdfd_vfd = fd;
mdfd->mdfd_segno = 0;
}
@@ -237,7 +237,7 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
* Note that we're passed a RelFileLocatorBackend --- by the time this is called,
* there won't be an SMgrRelation hashtable entry anymore.
*
* forkNum can be a fork number to delete a specific fork, or InvalidForkNumber
* forknum can be a fork number to delete a specific fork, or InvalidForkNumber
* to delete all forks.
*
* For regular relations, we don't unlink the first segment file of the rel,
@@ -278,16 +278,16 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
* we are usually not in a transaction anymore when this is called.
*/
void
mdunlink(RelFileLocatorBackend rlocator, ForkNumber forkNum, bool isRedo)
mdunlink(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo)
{
/* Now do the per-fork work */
if (forkNum == InvalidForkNumber)
if (forknum == InvalidForkNumber)
{
for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++)
mdunlinkfork(rlocator, forkNum, isRedo);
for (forknum = 0; forknum <= MAX_FORKNUM; forknum++)
mdunlinkfork(rlocator, forknum, isRedo);
}
else
mdunlinkfork(rlocator, forkNum, isRedo);
mdunlinkfork(rlocator, forknum, isRedo);
}
/*
@@ -315,18 +315,18 @@ do_truncate(const char *path)
}
static void
mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forkNum, bool isRedo)
mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forknum, bool isRedo)
{
char *path;
int ret;
BlockNumber segno = 0;
path = relpath(rlocator, forkNum);
path = relpath(rlocator, forknum);
/*
* Delete or truncate the first segment.
*/
if (isRedo || forkNum != MAIN_FORKNUM || RelFileLocatorBackendIsTemp(rlocator))
if (isRedo || forknum != MAIN_FORKNUM || RelFileLocatorBackendIsTemp(rlocator))
{
if (!RelFileLocatorBackendIsTemp(rlocator))
{
@@ -334,7 +334,7 @@ mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forkNum, bool isRedo)
ret = do_truncate(path);
/* Forget any pending sync requests for the first segment */
register_forget_request(rlocator, forkNum, 0 /* first seg */ );
register_forget_request(rlocator, forknum, 0 /* first seg */ );
}
else
ret = 0;
@@ -367,7 +367,7 @@ mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forkNum, bool isRedo)
*/
if (!IsBinaryUpgrade)
{
register_unlink_segment(rlocator, forkNum, 0 /* first seg */ );
register_unlink_segment(rlocator, forknum, 0 /* first seg */ );
++segno;
}
}
@@ -403,7 +403,7 @@ mdunlinkfork(RelFileLocatorBackend rlocator, ForkNumber forkNum, bool isRedo)
* Forget any pending sync requests for this segment before we
* try to unlink.
*/
register_forget_request(rlocator, forkNum, segno);
register_forget_request(rlocator, forknum, segno);
}
if (unlink(segpath) < 0)