aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2024-07-02 06:53:19 +0200
committerPeter Eisentraut <peter@eisentraut.org>2024-07-02 07:26:22 +0200
commit720b0eaae9b8a8326b2b6a6ff88fca4f47c631d4 (patch)
tree9e398e3bb3e6a229ed1007cff5f79192230dea71
parenta4c87df43a45a407a1f3fd584a7ffb32342628cc (diff)
downloadpostgresql-720b0eaae9b8a8326b2b6a6ff88fca4f47c631d4.tar.gz
postgresql-720b0eaae9b8a8326b2b6a6ff88fca4f47c631d4.zip
Convert some extern variables to static
These probably should have been static all along, it was only forgotten out of sloppiness. Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/flat/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org
-rw-r--r--contrib/isn/EAN13.h4
-rw-r--r--contrib/isn/ISBN.h8
-rw-r--r--contrib/isn/ISMN.h4
-rw-r--r--contrib/isn/ISSN.h4
-rw-r--r--contrib/isn/UPC.h4
-rw-r--r--src/backend/commands/user.c4
-rw-r--r--src/backend/postmaster/launch_backend.c2
-rw-r--r--src/backend/replication/logical/slotsync.c2
-rw-r--r--src/backend/replication/logical/worker.c2
-rw-r--r--src/backend/utils/misc/guc_tables.c7
-rw-r--r--src/bin/pg_archivecleanup/pg_archivecleanup.c15
-rw-r--r--src/bin/pg_basebackup/bbstreamer_file.c4
-rw-r--r--src/bin/pg_basebackup/bbstreamer_gzip.c4
-rw-r--r--src/bin/pg_basebackup/bbstreamer_inject.c2
-rw-r--r--src/bin/pg_basebackup/bbstreamer_lz4.c4
-rw-r--r--src/bin/pg_basebackup/bbstreamer_tar.c6
-rw-r--r--src/bin/pg_basebackup/bbstreamer_zstd.c4
-rw-r--r--src/bin/pg_basebackup/walmethods.c4
-rw-r--r--src/bin/pg_checksums/pg_checksums.c4
-rw-r--r--src/bin/pg_combinebackup/pg_combinebackup.c2
-rw-r--r--src/bin/pg_rewind/pg_rewind.c12
-rw-r--r--src/bin/pg_test_timing/pg_test_timing.c2
-rw-r--r--src/bin/pgbench/pgbench.c67
-rw-r--r--src/bin/scripts/vacuumdb.c2
-rw-r--r--src/pl/plpgsql/src/pl_handler.c4
-rw-r--r--src/test/isolation/isolation_main.c6
-rw-r--r--src/test/modules/dummy_index_am/dummy_index_am.c6
-rw-r--r--src/test/modules/libpq_pipeline/libpq_pipeline.c4
-rw-r--r--src/test/modules/test_json_parser/test_json_parser_incremental.c2
29 files changed, 99 insertions, 96 deletions
diff --git a/contrib/isn/EAN13.h b/contrib/isn/EAN13.h
index 7023ebdf638..52f104e5651 100644
--- a/contrib/isn/EAN13.h
+++ b/contrib/isn/EAN13.h
@@ -11,7 +11,7 @@
*/
/* where the digit set begins, and how many of them are in the table */
-const unsigned EAN13_index[10][2] = {
+static const unsigned EAN13_index[10][2] = {
{0, 6},
{6, 1},
{7, 1},
@@ -23,7 +23,7 @@ const unsigned EAN13_index[10][2] = {
{90, 17},
{107, 12},
};
-const char *EAN13_range[][2] = {
+static const char *EAN13_range[][2] = {
{"000", "019"}, /* GS1 US */
{"020", "029"}, /* Restricted distribution (MO defined) */
{"030", "039"}, /* GS1 US */
diff --git a/contrib/isn/ISBN.h b/contrib/isn/ISBN.h
index dbda6fb7241..30002899893 100644
--- a/contrib/isn/ISBN.h
+++ b/contrib/isn/ISBN.h
@@ -34,7 +34,7 @@
*/
/* where the digit set begins, and how many of them are in the table */
-const unsigned ISBN_index[10][2] = {
+static const unsigned ISBN_index[10][2] = {
{0, 6},
{6, 6},
{12, 8},
@@ -47,7 +47,7 @@ const unsigned ISBN_index[10][2] = {
{192, 718},
};
-const char *ISBN_range[][2] = {
+static const char *ISBN_range[][2] = {
{"0-00", "0-19"},
{"0-200", "0-699"},
{"0-7000", "0-8499"},
@@ -967,7 +967,7 @@ const char *ISBN_range[][2] = {
*/
/* where the digit set begins, and how many of them are in the table */
-const unsigned ISBN_index_new[10][2] = {
+static const unsigned ISBN_index_new[10][2] = {
{0, 0},
{0, 5},
{5, 0},
@@ -980,7 +980,7 @@ const unsigned ISBN_index_new[10][2] = {
{5, 0},
};
-const char *ISBN_range_new[][2] = {
+static const char *ISBN_range_new[][2] = {
{"10-00", "10-19"},
{"10-200", "10-699"},
{"10-7000", "10-8999"},
diff --git a/contrib/isn/ISMN.h b/contrib/isn/ISMN.h
index 281f2cdefcd..d8af1ed0443 100644
--- a/contrib/isn/ISMN.h
+++ b/contrib/isn/ISMN.h
@@ -30,7 +30,7 @@
*/
/* where the digit set begins, and how many of them are in the table */
-const unsigned ISMN_index[10][2] = {
+static const unsigned ISMN_index[10][2] = {
{0, 5},
{5, 0},
{5, 0},
@@ -42,7 +42,7 @@ const unsigned ISMN_index[10][2] = {
{5, 0},
{5, 0},
};
-const char *ISMN_range[][2] = {
+static const char *ISMN_range[][2] = {
{"0-000", "0-099"},
{"0-1000", "0-3999"},
{"0-40000", "0-69999"},
diff --git a/contrib/isn/ISSN.h b/contrib/isn/ISSN.h
index 585f0e26741..fe6fc7fb988 100644
--- a/contrib/isn/ISSN.h
+++ b/contrib/isn/ISSN.h
@@ -31,7 +31,7 @@
*/
/* where the digit set begins, and how many of them are in the table */
-const unsigned ISSN_index[10][2] = {
+static const unsigned ISSN_index[10][2] = {
{0, 1},
{0, 1},
{0, 1},
@@ -43,7 +43,7 @@ const unsigned ISSN_index[10][2] = {
{0, 1},
{0, 1},
};
-const char *ISSN_range[][2] = {
+static const char *ISSN_range[][2] = {
{"0000-000", "9999-999"},
{NULL, NULL}
};
diff --git a/contrib/isn/UPC.h b/contrib/isn/UPC.h
index b95473e12df..01b9f155925 100644
--- a/contrib/isn/UPC.h
+++ b/contrib/isn/UPC.h
@@ -11,7 +11,7 @@
*/
/* where the digit set begins, and how many of them are in the table */
-const unsigned UPC_index[10][2] = {
+static const unsigned UPC_index[10][2] = {
{0, 0},
{0, 0},
{0, 0},
@@ -23,6 +23,6 @@ const unsigned UPC_index[10][2] = {
{0, 0},
{0, 0},
};
-const char *UPC_range[][2] = {
+static const char *UPC_range[][2] = {
{NULL, NULL}
};
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index c75cde2e8e1..104b66e4b43 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -84,8 +84,8 @@ typedef struct
/* GUC parameters */
int Password_encryption = PASSWORD_TYPE_SCRAM_SHA_256;
char *createrole_self_grant = "";
-bool createrole_self_grant_enabled = false;
-GrantRoleOptions createrole_self_grant_options;
+static bool createrole_self_grant_enabled = false;
+static GrantRoleOptions createrole_self_grant_options;
/* Hook to check passwords in CreateRole() and AlterRole() */
check_password_hook_type check_password_hook = NULL;
diff --git a/src/backend/postmaster/launch_backend.c b/src/backend/postmaster/launch_backend.c
index bdfa238e4fe..bb1b0ac2b9c 100644
--- a/src/backend/postmaster/launch_backend.c
+++ b/src/backend/postmaster/launch_backend.c
@@ -176,7 +176,7 @@ typedef struct
bool shmem_attach;
} child_process_kind;
-child_process_kind child_process_kinds[] = {
+static child_process_kind child_process_kinds[] = {
[B_INVALID] = {"invalid", NULL, false},
[B_BACKEND] = {"backend", BackendMain, true},
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 94896aec284..e7738f2ea63 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -103,7 +103,7 @@ typedef struct SlotSyncCtxStruct
slock_t mutex;
} SlotSyncCtxStruct;
-SlotSyncCtxStruct *SlotSyncCtx = NULL;
+static SlotSyncCtxStruct *SlotSyncCtx = NULL;
/* GUC variable */
bool sync_replication_slots = false;
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index b5a80fe3e84..3b285894dbe 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -275,7 +275,7 @@ typedef enum
} TransApplyAction;
/* errcontext tracker */
-ApplyErrorCallbackArg apply_error_callback_arg =
+static ApplyErrorCallbackArg apply_error_callback_arg =
{
.command = 0,
.rel = NULL,
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 6f4188599b1..8ae3efbcd8e 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -517,7 +517,8 @@ bool check_function_bodies = true;
* This GUC exists solely for backward compatibility, check its definition for
* details.
*/
-bool default_with_oids = false;
+static bool default_with_oids = false;
+
bool current_role_is_superuser;
int log_min_error_statement = ERROR;
@@ -555,7 +556,7 @@ int tcp_user_timeout;
* This avoids breaking compatibility with clients that have never supported
* renegotiation and therefore always try to zero it.
*/
-int ssl_renegotiation_limit;
+static int ssl_renegotiation_limit;
/*
* This really belongs in pg_shmem.c, but is defined here so that it doesn't
@@ -563,7 +564,7 @@ int ssl_renegotiation_limit;
*/
int huge_pages = HUGE_PAGES_TRY;
int huge_page_size;
-int huge_pages_status = HUGE_PAGES_UNKNOWN;
+static int huge_pages_status = HUGE_PAGES_UNKNOWN;
/*
* These variables are all dummies that don't do anything, except in some
diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
index 07bf356b70c..5a124385b7c 100644
--- a/src/bin/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -19,17 +19,18 @@
#include "common/logging.h"
#include "getopt_long.h"
-const char *progname;
+static const char *progname;
/* Options and defaults */
-bool dryrun = false; /* are we performing a dry-run operation? */
-bool cleanBackupHistory = false; /* remove files including backup
+static bool dryrun = false; /* are we performing a dry-run operation? */
+static bool cleanBackupHistory = false; /* remove files including backup
* history files */
-char *additional_ext = NULL; /* Extension to remove from filenames */
+static char *additional_ext = NULL; /* Extension to remove from filenames */
-char *archiveLocation; /* where to find the archive? */
-char *restartWALFileName; /* the file from which we can restart restore */
-char exclusiveCleanupFileName[MAXFNAMELEN]; /* the oldest file we want
+static char *archiveLocation; /* where to find the archive? */
+static char *restartWALFileName; /* the file from which we can restart
+ * restore */
+static char exclusiveCleanupFileName[MAXFNAMELEN]; /* the oldest file we want
* to remain in archive */
diff --git a/src/bin/pg_basebackup/bbstreamer_file.c b/src/bin/pg_basebackup/bbstreamer_file.c
index 0be39dddc97..bab6cd4a6b1 100644
--- a/src/bin/pg_basebackup/bbstreamer_file.c
+++ b/src/bin/pg_basebackup/bbstreamer_file.c
@@ -43,7 +43,7 @@ static void bbstreamer_plain_writer_content(bbstreamer *streamer,
static void bbstreamer_plain_writer_finalize(bbstreamer *streamer);
static void bbstreamer_plain_writer_free(bbstreamer *streamer);
-const bbstreamer_ops bbstreamer_plain_writer_ops = {
+static const bbstreamer_ops bbstreamer_plain_writer_ops = {
.content = bbstreamer_plain_writer_content,
.finalize = bbstreamer_plain_writer_finalize,
.free = bbstreamer_plain_writer_free
@@ -59,7 +59,7 @@ static void extract_directory(const char *filename, mode_t mode);
static void extract_link(const char *filename, const char *linktarget);
static FILE *create_file_for_extract(const char *filename, mode_t mode);
-const bbstreamer_ops bbstreamer_extractor_ops = {
+static const bbstreamer_ops bbstreamer_extractor_ops = {
.content = bbstreamer_extractor_content,
.finalize = bbstreamer_extractor_finalize,
.free = bbstreamer_extractor_free
diff --git a/src/bin/pg_basebackup/bbstreamer_gzip.c b/src/bin/pg_basebackup/bbstreamer_gzip.c
index 4659314afd2..0417fd9bc2c 100644
--- a/src/bin/pg_basebackup/bbstreamer_gzip.c
+++ b/src/bin/pg_basebackup/bbstreamer_gzip.c
@@ -45,7 +45,7 @@ static void bbstreamer_gzip_writer_finalize(bbstreamer *streamer);
static void bbstreamer_gzip_writer_free(bbstreamer *streamer);
static const char *get_gz_error(gzFile gzf);
-const bbstreamer_ops bbstreamer_gzip_writer_ops = {
+static const bbstreamer_ops bbstreamer_gzip_writer_ops = {
.content = bbstreamer_gzip_writer_content,
.finalize = bbstreamer_gzip_writer_finalize,
.free = bbstreamer_gzip_writer_free
@@ -60,7 +60,7 @@ static void bbstreamer_gzip_decompressor_free(bbstreamer *streamer);
static void *gzip_palloc(void *opaque, unsigned items, unsigned size);
static void gzip_pfree(void *opaque, void *address);
-const bbstreamer_ops bbstreamer_gzip_decompressor_ops = {
+static const bbstreamer_ops bbstreamer_gzip_decompressor_ops = {
.content = bbstreamer_gzip_decompressor_content,
.finalize = bbstreamer_gzip_decompressor_finalize,
.free = bbstreamer_gzip_decompressor_free
diff --git a/src/bin/pg_basebackup/bbstreamer_inject.c b/src/bin/pg_basebackup/bbstreamer_inject.c
index e3ea94b4b65..194026b56e9 100644
--- a/src/bin/pg_basebackup/bbstreamer_inject.c
+++ b/src/bin/pg_basebackup/bbstreamer_inject.c
@@ -33,7 +33,7 @@ static void bbstreamer_recovery_injector_content(bbstreamer *streamer,
static void bbstreamer_recovery_injector_finalize(bbstreamer *streamer);
static void bbstreamer_recovery_injector_free(bbstreamer *streamer);
-const bbstreamer_ops bbstreamer_recovery_injector_ops = {
+static const bbstreamer_ops bbstreamer_recovery_injector_ops = {
.content = bbstreamer_recovery_injector_content,
.finalize = bbstreamer_recovery_injector_finalize,
.free = bbstreamer_recovery_injector_free
diff --git a/src/bin/pg_basebackup/bbstreamer_lz4.c b/src/bin/pg_basebackup/bbstreamer_lz4.c
index eda62caeded..f5c9e68150c 100644
--- a/src/bin/pg_basebackup/bbstreamer_lz4.c
+++ b/src/bin/pg_basebackup/bbstreamer_lz4.c
@@ -42,7 +42,7 @@ static void bbstreamer_lz4_compressor_content(bbstreamer *streamer,
static void bbstreamer_lz4_compressor_finalize(bbstreamer *streamer);
static void bbstreamer_lz4_compressor_free(bbstreamer *streamer);
-const bbstreamer_ops bbstreamer_lz4_compressor_ops = {
+static const bbstreamer_ops bbstreamer_lz4_compressor_ops = {
.content = bbstreamer_lz4_compressor_content,
.finalize = bbstreamer_lz4_compressor_finalize,
.free = bbstreamer_lz4_compressor_free
@@ -55,7 +55,7 @@ static void bbstreamer_lz4_decompressor_content(bbstreamer *streamer,
static void bbstreamer_lz4_decompressor_finalize(bbstreamer *streamer);
static void bbstreamer_lz4_decompressor_free(bbstreamer *streamer);
-const bbstreamer_ops bbstreamer_lz4_decompressor_ops = {
+static const bbstreamer_ops bbstreamer_lz4_decompressor_ops = {
.content = bbstreamer_lz4_decompressor_content,
.finalize = bbstreamer_lz4_decompressor_finalize,
.free = bbstreamer_lz4_decompressor_free
diff --git a/src/bin/pg_basebackup/bbstreamer_tar.c b/src/bin/pg_basebackup/bbstreamer_tar.c
index 83393f6119f..9137d17ddc1 100644
--- a/src/bin/pg_basebackup/bbstreamer_tar.c
+++ b/src/bin/pg_basebackup/bbstreamer_tar.c
@@ -50,7 +50,7 @@ static void bbstreamer_tar_parser_finalize(bbstreamer *streamer);
static void bbstreamer_tar_parser_free(bbstreamer *streamer);
static bool bbstreamer_tar_header(bbstreamer_tar_parser *mystreamer);
-const bbstreamer_ops bbstreamer_tar_parser_ops = {
+static const bbstreamer_ops bbstreamer_tar_parser_ops = {
.content = bbstreamer_tar_parser_content,
.finalize = bbstreamer_tar_parser_finalize,
.free = bbstreamer_tar_parser_free
@@ -63,7 +63,7 @@ static void bbstreamer_tar_archiver_content(bbstreamer *streamer,
static void bbstreamer_tar_archiver_finalize(bbstreamer *streamer);
static void bbstreamer_tar_archiver_free(bbstreamer *streamer);
-const bbstreamer_ops bbstreamer_tar_archiver_ops = {
+static const bbstreamer_ops bbstreamer_tar_archiver_ops = {
.content = bbstreamer_tar_archiver_content,
.finalize = bbstreamer_tar_archiver_finalize,
.free = bbstreamer_tar_archiver_free
@@ -76,7 +76,7 @@ static void bbstreamer_tar_terminator_content(bbstreamer *streamer,
static void bbstreamer_tar_terminator_finalize(bbstreamer *streamer);
static void bbstreamer_tar_terminator_free(bbstreamer *streamer);
-const bbstreamer_ops bbstreamer_tar_terminator_ops = {
+static const bbstreamer_ops bbstreamer_tar_terminator_ops = {
.content = bbstreamer_tar_terminator_content,
.finalize = bbstreamer_tar_terminator_finalize,
.free = bbstreamer_tar_terminator_free
diff --git a/src/bin/pg_basebackup/bbstreamer_zstd.c b/src/bin/pg_basebackup/bbstreamer_zstd.c
index 9e09f8f90bf..20f11d4450e 100644
--- a/src/bin/pg_basebackup/bbstreamer_zstd.c
+++ b/src/bin/pg_basebackup/bbstreamer_zstd.c
@@ -38,7 +38,7 @@ static void bbstreamer_zstd_compressor_content(bbstreamer *streamer,
static void bbstreamer_zstd_compressor_finalize(bbstreamer *streamer);
static void bbstreamer_zstd_compressor_free(bbstreamer *streamer);
-const bbstreamer_ops bbstreamer_zstd_compressor_ops = {
+static const bbstreamer_ops bbstreamer_zstd_compressor_ops = {
.content = bbstreamer_zstd_compressor_content,
.finalize = bbstreamer_zstd_compressor_finalize,
.free = bbstreamer_zstd_compressor_free
@@ -51,7 +51,7 @@ static void bbstreamer_zstd_decompressor_content(bbstreamer *streamer,
static void bbstreamer_zstd_decompressor_finalize(bbstreamer *streamer);
static void bbstreamer_zstd_decompressor_free(bbstreamer *streamer);
-const bbstreamer_ops bbstreamer_zstd_decompressor_ops = {
+static const bbstreamer_ops bbstreamer_zstd_decompressor_ops = {
.content = bbstreamer_zstd_decompressor_content,
.finalize = bbstreamer_zstd_decompressor_finalize,
.free = bbstreamer_zstd_decompressor_free
diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c
index f17600de9d2..832aafd2973 100644
--- a/src/bin/pg_basebackup/walmethods.c
+++ b/src/bin/pg_basebackup/walmethods.c
@@ -55,7 +55,7 @@ static int dir_sync(Walfile *f);
static bool dir_finish(WalWriteMethod *wwmethod);
static void dir_free(WalWriteMethod *wwmethod);
-const WalWriteMethodOps WalDirectoryMethodOps = {
+static const WalWriteMethodOps WalDirectoryMethodOps = {
.open_for_write = dir_open_for_write,
.close = dir_close,
.existsfile = dir_existsfile,
@@ -676,7 +676,7 @@ static int tar_sync(Walfile *f);
static bool tar_finish(WalWriteMethod *wwmethod);
static void tar_free(WalWriteMethod *wwmethod);
-const WalWriteMethodOps WalTarMethodOps = {
+static const WalWriteMethodOps WalTarMethodOps = {
.open_for_write = tar_open_for_write,
.close = tar_close,
.existsfile = tar_existsfile,
diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
index 9e6fd435f60..b5bb0e78875 100644
--- a/src/bin/pg_checksums/pg_checksums.c
+++ b/src/bin/pg_checksums/pg_checksums.c
@@ -60,8 +60,8 @@ static const char *progname;
/*
* Progress status information.
*/
-int64 total_size = 0;
-int64 current_size = 0;
+static int64 total_size = 0;
+static int64 current_size = 0;
static pg_time_t last_progress_report = 0;
static void
diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c
index 986a256dea5..9ded5a2140e 100644
--- a/src/bin/pg_combinebackup/pg_combinebackup.c
+++ b/src/bin/pg_combinebackup/pg_combinebackup.c
@@ -97,7 +97,7 @@ typedef struct cb_tablespace
} cb_tablespace;
/* Directories to be removed if we exit uncleanly. */
-cb_cleanup_dir *cleanup_dir_list = NULL;
+static cb_cleanup_dir *cleanup_dir_list = NULL;
static void add_tablespace_mapping(cb_options *opt, char *arg);
static StringInfo check_backup_label_files(int n_backups, char **backup_dirs);
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 8dfea05846e..0841ab4135b 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -60,21 +60,21 @@ static ControlFileData ControlFile_target;
static ControlFileData ControlFile_source;
static ControlFileData ControlFile_source_after;
-const char *progname;
+static const char *progname;
int WalSegSz;
/* Configuration options */
char *datadir_target = NULL;
-char *datadir_source = NULL;
-char *connstr_source = NULL;
-char *restore_command = NULL;
-char *config_file = NULL;
+static char *datadir_source = NULL;
+static char *connstr_source = NULL;
+static char *restore_command = NULL;
+static char *config_file = NULL;
static bool debug = false;
bool showprogress = false;
bool dry_run = false;
bool do_sync = true;
-bool restore_wal = false;
+static bool restore_wal = false;
DataDirSyncMethod sync_method = DATA_DIR_SYNC_METHOD_FSYNC;
/* Target history */
diff --git a/src/bin/pg_test_timing/pg_test_timing.c b/src/bin/pg_test_timing/pg_test_timing.c
index c29d6f87629..ce7aad4b25a 100644
--- a/src/bin/pg_test_timing/pg_test_timing.c
+++ b/src/bin/pg_test_timing/pg_test_timing.c
@@ -20,7 +20,7 @@ static uint64 test_timing(unsigned int duration);
static void output(uint64 loop_count);
/* record duration in powers of 2 microseconds */
-long long int histogram[32];
+static long long int histogram[32];
int
main(int argc, char *argv[])
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 86ffb3c8683..e3dc6f9b190 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -170,37 +170,37 @@ typedef struct socket_set
#define MIN_ZIPFIAN_PARAM 1.001 /* minimum parameter for zipfian */
#define MAX_ZIPFIAN_PARAM 1000.0 /* maximum parameter for zipfian */
-int nxacts = 0; /* number of transactions per client */
-int duration = 0; /* duration in seconds */
-int64 end_time = 0; /* when to stop in micro seconds, under -T */
+static int nxacts = 0; /* number of transactions per client */
+static int duration = 0; /* duration in seconds */
+static int64 end_time = 0; /* when to stop in micro seconds, under -T */
/*
* scaling factor. for example, scale = 10 will make 1000000 tuples in
* pgbench_accounts table.
*/
-int scale = 1;
+static int scale = 1;
/*
* fillfactor. for example, fillfactor = 90 will use only 90 percent
* space during inserts and leave 10 percent free.
*/
-int fillfactor = 100;
+static int fillfactor = 100;
/*
* use unlogged tables?
*/
-bool unlogged_tables = false;
+static bool unlogged_tables = false;
/*
* log sampling rate (1.0 = log everything, 0.0 = option not given)
*/
-double sample_rate = 0.0;
+static double sample_rate = 0.0;
/*
* When threads are throttled to a given rate limit, this is the target delay
* to reach that rate in usec. 0 is the default and means no throttling.
*/
-double throttle_delay = 0;
+static double throttle_delay = 0;
/*
* Transactions which take longer than this limit (in usec) are counted as
@@ -208,13 +208,13 @@ double throttle_delay = 0;
* throttling is enabled, execution time slots that are more than this late
* are skipped altogether, and counted separately.
*/
-int64 latency_limit = 0;
+static int64 latency_limit = 0;
/*
* tablespace selection
*/
-char *tablespace = NULL;
-char *index_tablespace = NULL;
+static char *tablespace = NULL;
+static char *index_tablespace = NULL;
/*
* Number of "pgbench_accounts" partitions. 0 is the default and means no
@@ -234,7 +234,7 @@ static partition_method_t partition_method = PART_NONE;
static const char *const PARTITION_METHOD[] = {"none", "range", "hash"};
/* random seed used to initialize base_random_sequence */
-int64 random_seed = -1;
+static int64 random_seed = -1;
/*
* end of configurable parameters
@@ -254,20 +254,20 @@ int64 random_seed = -1;
*/
#define SCALE_32BIT_THRESHOLD 20000
-bool use_log; /* log transaction latencies to a file */
-bool use_quiet; /* quiet logging onto stderr */
-int agg_interval; /* log aggregates instead of individual
+static bool use_log; /* log transaction latencies to a file */
+static bool use_quiet; /* quiet logging onto stderr */
+static int agg_interval; /* log aggregates instead of individual
* transactions */
-bool per_script_stats = false; /* whether to collect stats per script */
-int progress = 0; /* thread progress report every this seconds */
-bool progress_timestamp = false; /* progress report with Unix time */
-int nclients = 1; /* number of clients */
-int nthreads = 1; /* number of threads */
-bool is_connect; /* establish connection for each transaction */
-bool report_per_command = false; /* report per-command latencies,
+static bool per_script_stats = false; /* whether to collect stats per script */
+static int progress = 0; /* thread progress report every this seconds */
+static bool progress_timestamp = false; /* progress report with Unix time */
+static int nclients = 1; /* number of clients */
+static int nthreads = 1; /* number of threads */
+static bool is_connect; /* establish connection for each transaction */
+static bool report_per_command = false; /* report per-command latencies,
* retries after errors and failures
* (errors without retrying) */
-int main_pid; /* main process id used in log filename */
+static int main_pid; /* main process id used in log filename */
/*
* There are different types of restrictions for deciding that the current
@@ -287,21 +287,22 @@ int main_pid; /* main process id used in log filename */
* We cannot retry a transaction after the serialization/deadlock error if its
* number of tries reaches this maximum; if its value is zero, it is not used.
*/
-uint32 max_tries = 1;
+static uint32 max_tries = 1;
-bool failures_detailed = false; /* whether to group failures in
+static bool failures_detailed = false; /* whether to group failures in
* reports or logs by basic types */
-const char *pghost = NULL;
-const char *pgport = NULL;
-const char *username = NULL;
-const char *dbName = NULL;
-char *logfile_prefix = NULL;
-const char *progname;
+static const char *pghost = NULL;
+static const char *pgport = NULL;
+static const char *username = NULL;
+static const char *dbName = NULL;
+static char *logfile_prefix = NULL;
+static const char *progname;
#define WSEP '@' /* weight separator */
-volatile sig_atomic_t timer_exceeded = false; /* flag from signal handler */
+volatile static sig_atomic_t timer_exceeded = false; /* flag from signal
+ * handler */
/*
* We don't want to allocate variables one by one; for efficiency, add a
@@ -446,7 +447,7 @@ typedef struct StatsData
* For displaying Unix epoch timestamps, as some time functions may have
* another reference.
*/
-pg_time_usec_t epoch_shift;
+static pg_time_usec_t epoch_shift;
/*
* Error status for errors during script execution.
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c
index 7138c6e97e4..7c33e13e1ac 100644
--- a/src/bin/scripts/vacuumdb.c
+++ b/src/bin/scripts/vacuumdb.c
@@ -60,7 +60,7 @@ typedef enum
OBJFILTER_SCHEMA_EXCLUDE = (1 << 4), /* -N | --exclude-schema */
} VacObjFilter;
-VacObjFilter objfilter = OBJFILTER_NONE;
+static VacObjFilter objfilter = OBJFILTER_NONE;
static void vacuum_one_database(ConnParams *cparams,
vacuumingOptions *vacopts,
diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c
index fce459ade08..980f0961bc8 100644
--- a/src/pl/plpgsql/src/pl_handler.c
+++ b/src/pl/plpgsql/src/pl_handler.c
@@ -47,8 +47,8 @@ bool plpgsql_print_strict_params = false;
bool plpgsql_check_asserts = true;
-char *plpgsql_extra_warnings_string = NULL;
-char *plpgsql_extra_errors_string = NULL;
+static char *plpgsql_extra_warnings_string = NULL;
+static char *plpgsql_extra_errors_string = NULL;
int plpgsql_extra_warnings;
int plpgsql_extra_errors;
diff --git a/src/test/isolation/isolation_main.c b/src/test/isolation/isolation_main.c
index 2a3e41d2101..8b108a31b11 100644
--- a/src/test/isolation/isolation_main.c
+++ b/src/test/isolation/isolation_main.c
@@ -15,9 +15,9 @@
#include "lib/stringinfo.h"
#include "pg_regress.h"
-char saved_argv0[MAXPGPATH];
-char isolation_exec[MAXPGPATH];
-bool looked_up_isolation_exec = false;
+static char saved_argv0[MAXPGPATH];
+static char isolation_exec[MAXPGPATH];
+static bool looked_up_isolation_exec = false;
#define PG_ISOLATION_VERSIONSTR "isolationtester (PostgreSQL) " PG_VERSION "\n"
diff --git a/src/test/modules/dummy_index_am/dummy_index_am.c b/src/test/modules/dummy_index_am/dummy_index_am.c
index 18185d02067..0b477116067 100644
--- a/src/test/modules/dummy_index_am/dummy_index_am.c
+++ b/src/test/modules/dummy_index_am/dummy_index_am.c
@@ -24,10 +24,10 @@
PG_MODULE_MAGIC;
/* parse table for fillRelOptions */
-relopt_parse_elt di_relopt_tab[6];
+static relopt_parse_elt di_relopt_tab[6];
/* Kind of relation options for dummy index */
-relopt_kind di_relopt_kind;
+static relopt_kind di_relopt_kind;
typedef enum DummyAmEnum
{
@@ -47,7 +47,7 @@ typedef struct DummyIndexOptions
int option_string_null_offset;
} DummyIndexOptions;
-relopt_enum_elt_def dummyAmEnumValues[] =
+static relopt_enum_elt_def dummyAmEnumValues[] =
{
{"one", DUMMY_AM_ENUM_ONE},
{"two", DUMMY_AM_ENUM_TWO},
diff --git a/src/test/modules/libpq_pipeline/libpq_pipeline.c b/src/test/modules/libpq_pipeline/libpq_pipeline.c
index ac4d26302cc..999a7f57a7e 100644
--- a/src/test/modules/libpq_pipeline/libpq_pipeline.c
+++ b/src/test/modules/libpq_pipeline/libpq_pipeline.c
@@ -31,10 +31,10 @@ static void pg_attribute_noreturn() pg_fatal_impl(int line, const char *fmt,...)
static bool process_result(PGconn *conn, PGresult *res, int results,
int numsent);
-const char *const progname = "libpq_pipeline";
+static const char *const progname = "libpq_pipeline";
/* Options and defaults */
-char *tracefile = NULL; /* path to PQtrace() file */
+static char *tracefile = NULL; /* path to PQtrace() file */
#ifdef DEBUG_OUTPUT
diff --git a/src/test/modules/test_json_parser/test_json_parser_incremental.c b/src/test/modules/test_json_parser/test_json_parser_incremental.c
index 7cd3dcf276b..f4c442ac365 100644
--- a/src/test/modules/test_json_parser/test_json_parser_incremental.c
+++ b/src/test/modules/test_json_parser/test_json_parser_incremental.c
@@ -60,7 +60,7 @@ static JsonParseErrorType do_array_element_start(void *state, bool isnull);
static JsonParseErrorType do_array_element_end(void *state, bool isnull);
static JsonParseErrorType do_scalar(void *state, char *token, JsonTokenType tokentype);
-JsonSemAction sem = {
+static JsonSemAction sem = {
.object_start = do_object_start,
.object_end = do_object_end,
.object_field_start = do_object_field_start,