v8-0004-cleanup-avoid-local-wal_level-and-wal_segment_siz.patch
application/octet-stream
Filename: v8-0004-cleanup-avoid-local-wal_level-and-wal_segment_siz.patch
Type: application/octet-stream
Part: 3
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v8-0004
Subject: cleanup: avoid local wal_level and wal_segment_size being shadowed by globals
| File | + | − |
|---|---|---|
| src/backend/access/rmgrdesc/xlogdesc.c | 3 | 3 |
| src/backend/access/transam/xlogreader.c | 2 | 2 |
| src/bin/pg_controldata/pg_controldata.c | 2 | 2 |
| src/include/access/xlogreader.h | 1 | 1 |
From cf97f39017f97ad17636f3ccb12f5e5ce318e9ed Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Tue, 2 Dec 2025 13:45:05 +0800
Subject: [PATCH v8 04/12] cleanup: avoid local wal_level and wal_segment_size
being shadowed by globals
This commit fixes cases where local variables named wal_level and
wal_segment_size were shadowed by global identifiers of the same names.
The local variables are renamed so they are no longer shadowed by the
globals.
Author: Chao Li <lic@highgo.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CAEoWx2kQ2x5gMaj8tHLJ3=jfC+p5YXHkJyHrDTiQw2nn2FJTmQ@mail.gmail.com
---
src/backend/access/rmgrdesc/xlogdesc.c | 6 +++---
src/backend/access/transam/xlogreader.c | 4 ++--
src/bin/pg_controldata/pg_controldata.c | 4 ++--
src/include/access/xlogreader.h | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c
index 2468a7d2578..9af5b42b347 100644
--- a/src/backend/access/rmgrdesc/xlogdesc.c
+++ b/src/backend/access/rmgrdesc/xlogdesc.c
@@ -35,17 +35,17 @@ const struct config_enum_entry wal_level_options[] = {
};
/*
- * Find a string representation for wal_level
+ * Find a string representation for wal level
*/
static const char *
-get_wal_level_string(int wal_level)
+get_wal_level_string(int level)
{
const struct config_enum_entry *entry;
const char *wal_level_str = "?";
for (entry = wal_level_options; entry->name; entry++)
{
- if (entry->val == wal_level)
+ if (entry->val == level)
{
wal_level_str = entry->name;
break;
diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index 8849610db00..f3360698278 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -105,7 +105,7 @@ XLogReaderSetDecodeBuffer(XLogReaderState *state, void *buffer, size_t size)
* Returns NULL if the xlogreader couldn't be allocated.
*/
XLogReaderState *
-XLogReaderAllocate(int wal_segment_size, const char *waldir,
+XLogReaderAllocate(int wal_seg_size, const char *waldir,
XLogReaderRoutine *routine, void *private_data)
{
XLogReaderState *state;
@@ -135,7 +135,7 @@ XLogReaderAllocate(int wal_segment_size, const char *waldir,
}
/* Initialize segment info. */
- WALOpenSegmentInit(&state->seg, &state->segcxt, wal_segment_size,
+ WALOpenSegmentInit(&state->seg, &state->segcxt, wal_seg_size,
waldir);
/* system_identifier initialized to zeroes above */
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index fe5fc5ec133..1d2577bb2c0 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -70,9 +70,9 @@ dbState(DBState state)
}
static const char *
-wal_level_str(WalLevel wal_level)
+wal_level_str(WalLevel level)
{
- switch (wal_level)
+ switch (level)
{
case WAL_LEVEL_MINIMAL:
return "minimal";
diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h
index 97eae2c1dab..73d35144dff 100644
--- a/src/include/access/xlogreader.h
+++ b/src/include/access/xlogreader.h
@@ -327,7 +327,7 @@ XLogReaderHasQueuedRecordOrError(XLogReaderState *state)
}
/* Get a new XLogReader */
-extern XLogReaderState *XLogReaderAllocate(int wal_segment_size,
+extern XLogReaderState *XLogReaderAllocate(int wal_seg_size,
const char *waldir,
XLogReaderRoutine *routine,
void *private_data);
--
2.50.1 (Apple Git-155)