Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 720b0ea

Browse filesBrowse files
committed
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
1 parent a4c87df commit 720b0ea
Copy full SHA for 720b0ea

File tree

Expand file treeCollapse file tree

29 files changed

+99
-96
lines changed
Filter options
Expand file treeCollapse file tree

29 files changed

+99
-96
lines changed

‎contrib/isn/EAN13.h

Copy file name to clipboardExpand all lines: contrib/isn/EAN13.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
/* where the digit set begins, and how many of them are in the table */
14-
const unsigned EAN13_index[10][2] = {
14+
static const unsigned EAN13_index[10][2] = {
1515
{0, 6},
1616
{6, 1},
1717
{7, 1},
@@ -23,7 +23,7 @@ const unsigned EAN13_index[10][2] = {
2323
{90, 17},
2424
{107, 12},
2525
};
26-
const char *EAN13_range[][2] = {
26+
static const char *EAN13_range[][2] = {
2727
{"000", "019"}, /* GS1 US */
2828
{"020", "029"}, /* Restricted distribution (MO defined) */
2929
{"030", "039"}, /* GS1 US */

‎contrib/isn/ISBN.h

Copy file name to clipboardExpand all lines: contrib/isn/ISBN.h
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535

3636
/* where the digit set begins, and how many of them are in the table */
37-
const unsigned ISBN_index[10][2] = {
37+
static const unsigned ISBN_index[10][2] = {
3838
{0, 6},
3939
{6, 6},
4040
{12, 8},
@@ -47,7 +47,7 @@ const unsigned ISBN_index[10][2] = {
4747
{192, 718},
4848
};
4949

50-
const char *ISBN_range[][2] = {
50+
static const char *ISBN_range[][2] = {
5151
{"0-00", "0-19"},
5252
{"0-200", "0-699"},
5353
{"0-7000", "0-8499"},
@@ -967,7 +967,7 @@ const char *ISBN_range[][2] = {
967967
*/
968968

969969
/* where the digit set begins, and how many of them are in the table */
970-
const unsigned ISBN_index_new[10][2] = {
970+
static const unsigned ISBN_index_new[10][2] = {
971971
{0, 0},
972972
{0, 5},
973973
{5, 0},
@@ -980,7 +980,7 @@ const unsigned ISBN_index_new[10][2] = {
980980
{5, 0},
981981
};
982982

983-
const char *ISBN_range_new[][2] = {
983+
static const char *ISBN_range_new[][2] = {
984984
{"10-00", "10-19"},
985985
{"10-200", "10-699"},
986986
{"10-7000", "10-8999"},

‎contrib/isn/ISMN.h

Copy file name to clipboardExpand all lines: contrib/isn/ISMN.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131

3232
/* where the digit set begins, and how many of them are in the table */
33-
const unsigned ISMN_index[10][2] = {
33+
static const unsigned ISMN_index[10][2] = {
3434
{0, 5},
3535
{5, 0},
3636
{5, 0},
@@ -42,7 +42,7 @@ const unsigned ISMN_index[10][2] = {
4242
{5, 0},
4343
{5, 0},
4444
};
45-
const char *ISMN_range[][2] = {
45+
static const char *ISMN_range[][2] = {
4646
{"0-000", "0-099"},
4747
{"0-1000", "0-3999"},
4848
{"0-40000", "0-69999"},

‎contrib/isn/ISSN.h

Copy file name to clipboardExpand all lines: contrib/isn/ISSN.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232

3333
/* where the digit set begins, and how many of them are in the table */
34-
const unsigned ISSN_index[10][2] = {
34+
static const unsigned ISSN_index[10][2] = {
3535
{0, 1},
3636
{0, 1},
3737
{0, 1},
@@ -43,7 +43,7 @@ const unsigned ISSN_index[10][2] = {
4343
{0, 1},
4444
{0, 1},
4545
};
46-
const char *ISSN_range[][2] = {
46+
static const char *ISSN_range[][2] = {
4747
{"0000-000", "9999-999"},
4848
{NULL, NULL}
4949
};

‎contrib/isn/UPC.h

Copy file name to clipboardExpand all lines: contrib/isn/UPC.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
/* where the digit set begins, and how many of them are in the table */
14-
const unsigned UPC_index[10][2] = {
14+
static const unsigned UPC_index[10][2] = {
1515
{0, 0},
1616
{0, 0},
1717
{0, 0},
@@ -23,6 +23,6 @@ const unsigned UPC_index[10][2] = {
2323
{0, 0},
2424
{0, 0},
2525
};
26-
const char *UPC_range[][2] = {
26+
static const char *UPC_range[][2] = {
2727
{NULL, NULL}
2828
};

‎src/backend/commands/user.c

Copy file name to clipboardExpand all lines: src/backend/commands/user.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ typedef struct
8484
/* GUC parameters */
8585
int Password_encryption = PASSWORD_TYPE_SCRAM_SHA_256;
8686
char *createrole_self_grant = "";
87-
bool createrole_self_grant_enabled = false;
88-
GrantRoleOptions createrole_self_grant_options;
87+
static bool createrole_self_grant_enabled = false;
88+
static GrantRoleOptions createrole_self_grant_options;
8989

9090
/* Hook to check passwords in CreateRole() and AlterRole() */
9191
check_password_hook_type check_password_hook = NULL;

‎src/backend/postmaster/launch_backend.c

Copy file name to clipboardExpand all lines: src/backend/postmaster/launch_backend.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ typedef struct
176176
bool shmem_attach;
177177
} child_process_kind;
178178

179-
child_process_kind child_process_kinds[] = {
179+
static child_process_kind child_process_kinds[] = {
180180
[B_INVALID] = {"invalid", NULL, false},
181181

182182
[B_BACKEND] = {"backend", BackendMain, true},

‎src/backend/replication/logical/slotsync.c

Copy file name to clipboardExpand all lines: src/backend/replication/logical/slotsync.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ typedef struct SlotSyncCtxStruct
103103
slock_t mutex;
104104
} SlotSyncCtxStruct;
105105

106-
SlotSyncCtxStruct *SlotSyncCtx = NULL;
106+
static SlotSyncCtxStruct *SlotSyncCtx = NULL;
107107

108108
/* GUC variable */
109109
bool sync_replication_slots = false;

‎src/backend/replication/logical/worker.c

Copy file name to clipboardExpand all lines: src/backend/replication/logical/worker.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ typedef enum
275275
} TransApplyAction;
276276

277277
/* errcontext tracker */
278-
ApplyErrorCallbackArg apply_error_callback_arg =
278+
static ApplyErrorCallbackArg apply_error_callback_arg =
279279
{
280280
.command = 0,
281281
.rel = NULL,

‎src/backend/utils/misc/guc_tables.c

Copy file name to clipboardExpand all lines: src/backend/utils/misc/guc_tables.c
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@ bool check_function_bodies = true;
517517
* This GUC exists solely for backward compatibility, check its definition for
518518
* details.
519519
*/
520-
bool default_with_oids = false;
520+
static bool default_with_oids = false;
521+
521522
bool current_role_is_superuser;
522523

523524
int log_min_error_statement = ERROR;
@@ -555,15 +556,15 @@ int tcp_user_timeout;
555556
* This avoids breaking compatibility with clients that have never supported
556557
* renegotiation and therefore always try to zero it.
557558
*/
558-
int ssl_renegotiation_limit;
559+
static int ssl_renegotiation_limit;
559560

560561
/*
561562
* This really belongs in pg_shmem.c, but is defined here so that it doesn't
562563
* need to be duplicated in all the different implementations of pg_shmem.c.
563564
*/
564565
int huge_pages = HUGE_PAGES_TRY;
565566
int huge_page_size;
566-
int huge_pages_status = HUGE_PAGES_UNKNOWN;
567+
static int huge_pages_status = HUGE_PAGES_UNKNOWN;
567568

568569
/*
569570
* These variables are all dummies that don't do anything, except in some

‎src/bin/pg_archivecleanup/pg_archivecleanup.c

Copy file name to clipboardExpand all lines: src/bin/pg_archivecleanup/pg_archivecleanup.c
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@
1919
#include "common/logging.h"
2020
#include "getopt_long.h"
2121

22-
const char *progname;
22+
static const char *progname;
2323

2424
/* Options and defaults */
25-
bool dryrun = false; /* are we performing a dry-run operation? */
26-
bool cleanBackupHistory = false; /* remove files including backup
25+
static bool dryrun = false; /* are we performing a dry-run operation? */
26+
static bool cleanBackupHistory = false; /* remove files including backup
2727
* history files */
28-
char *additional_ext = NULL; /* Extension to remove from filenames */
28+
static char *additional_ext = NULL; /* Extension to remove from filenames */
2929

30-
char *archiveLocation; /* where to find the archive? */
31-
char *restartWALFileName; /* the file from which we can restart restore */
32-
char exclusiveCleanupFileName[MAXFNAMELEN]; /* the oldest file we want
30+
static char *archiveLocation; /* where to find the archive? */
31+
static char *restartWALFileName; /* the file from which we can restart
32+
* restore */
33+
static char exclusiveCleanupFileName[MAXFNAMELEN]; /* the oldest file we want
3334
* to remain in archive */
3435

3536

‎src/bin/pg_basebackup/bbstreamer_file.c

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/bbstreamer_file.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static void bbstreamer_plain_writer_content(bbstreamer *streamer,
4343
static void bbstreamer_plain_writer_finalize(bbstreamer *streamer);
4444
static void bbstreamer_plain_writer_free(bbstreamer *streamer);
4545

46-
const bbstreamer_ops bbstreamer_plain_writer_ops = {
46+
static const bbstreamer_ops bbstreamer_plain_writer_ops = {
4747
.content = bbstreamer_plain_writer_content,
4848
.finalize = bbstreamer_plain_writer_finalize,
4949
.free = bbstreamer_plain_writer_free
@@ -59,7 +59,7 @@ static void extract_directory(const char *filename, mode_t mode);
5959
static void extract_link(const char *filename, const char *linktarget);
6060
static FILE *create_file_for_extract(const char *filename, mode_t mode);
6161

62-
const bbstreamer_ops bbstreamer_extractor_ops = {
62+
static const bbstreamer_ops bbstreamer_extractor_ops = {
6363
.content = bbstreamer_extractor_content,
6464
.finalize = bbstreamer_extractor_finalize,
6565
.free = bbstreamer_extractor_free

‎src/bin/pg_basebackup/bbstreamer_gzip.c

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/bbstreamer_gzip.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void bbstreamer_gzip_writer_finalize(bbstreamer *streamer);
4545
static void bbstreamer_gzip_writer_free(bbstreamer *streamer);
4646
static const char *get_gz_error(gzFile gzf);
4747

48-
const bbstreamer_ops bbstreamer_gzip_writer_ops = {
48+
static const bbstreamer_ops bbstreamer_gzip_writer_ops = {
4949
.content = bbstreamer_gzip_writer_content,
5050
.finalize = bbstreamer_gzip_writer_finalize,
5151
.free = bbstreamer_gzip_writer_free
@@ -60,7 +60,7 @@ static void bbstreamer_gzip_decompressor_free(bbstreamer *streamer);
6060
static void *gzip_palloc(void *opaque, unsigned items, unsigned size);
6161
static void gzip_pfree(void *opaque, void *address);
6262

63-
const bbstreamer_ops bbstreamer_gzip_decompressor_ops = {
63+
static const bbstreamer_ops bbstreamer_gzip_decompressor_ops = {
6464
.content = bbstreamer_gzip_decompressor_content,
6565
.finalize = bbstreamer_gzip_decompressor_finalize,
6666
.free = bbstreamer_gzip_decompressor_free

‎src/bin/pg_basebackup/bbstreamer_inject.c

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/bbstreamer_inject.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static void bbstreamer_recovery_injector_content(bbstreamer *streamer,
3333
static void bbstreamer_recovery_injector_finalize(bbstreamer *streamer);
3434
static void bbstreamer_recovery_injector_free(bbstreamer *streamer);
3535

36-
const bbstreamer_ops bbstreamer_recovery_injector_ops = {
36+
static const bbstreamer_ops bbstreamer_recovery_injector_ops = {
3737
.content = bbstreamer_recovery_injector_content,
3838
.finalize = bbstreamer_recovery_injector_finalize,
3939
.free = bbstreamer_recovery_injector_free

‎src/bin/pg_basebackup/bbstreamer_lz4.c

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/bbstreamer_lz4.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void bbstreamer_lz4_compressor_content(bbstreamer *streamer,
4242
static void bbstreamer_lz4_compressor_finalize(bbstreamer *streamer);
4343
static void bbstreamer_lz4_compressor_free(bbstreamer *streamer);
4444

45-
const bbstreamer_ops bbstreamer_lz4_compressor_ops = {
45+
static const bbstreamer_ops bbstreamer_lz4_compressor_ops = {
4646
.content = bbstreamer_lz4_compressor_content,
4747
.finalize = bbstreamer_lz4_compressor_finalize,
4848
.free = bbstreamer_lz4_compressor_free
@@ -55,7 +55,7 @@ static void bbstreamer_lz4_decompressor_content(bbstreamer *streamer,
5555
static void bbstreamer_lz4_decompressor_finalize(bbstreamer *streamer);
5656
static void bbstreamer_lz4_decompressor_free(bbstreamer *streamer);
5757

58-
const bbstreamer_ops bbstreamer_lz4_decompressor_ops = {
58+
static const bbstreamer_ops bbstreamer_lz4_decompressor_ops = {
5959
.content = bbstreamer_lz4_decompressor_content,
6060
.finalize = bbstreamer_lz4_decompressor_finalize,
6161
.free = bbstreamer_lz4_decompressor_free

‎src/bin/pg_basebackup/bbstreamer_tar.c

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/bbstreamer_tar.c
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static void bbstreamer_tar_parser_finalize(bbstreamer *streamer);
5050
static void bbstreamer_tar_parser_free(bbstreamer *streamer);
5151
static bool bbstreamer_tar_header(bbstreamer_tar_parser *mystreamer);
5252

53-
const bbstreamer_ops bbstreamer_tar_parser_ops = {
53+
static const bbstreamer_ops bbstreamer_tar_parser_ops = {
5454
.content = bbstreamer_tar_parser_content,
5555
.finalize = bbstreamer_tar_parser_finalize,
5656
.free = bbstreamer_tar_parser_free
@@ -63,7 +63,7 @@ static void bbstreamer_tar_archiver_content(bbstreamer *streamer,
6363
static void bbstreamer_tar_archiver_finalize(bbstreamer *streamer);
6464
static void bbstreamer_tar_archiver_free(bbstreamer *streamer);
6565

66-
const bbstreamer_ops bbstreamer_tar_archiver_ops = {
66+
static const bbstreamer_ops bbstreamer_tar_archiver_ops = {
6767
.content = bbstreamer_tar_archiver_content,
6868
.finalize = bbstreamer_tar_archiver_finalize,
6969
.free = bbstreamer_tar_archiver_free
@@ -76,7 +76,7 @@ static void bbstreamer_tar_terminator_content(bbstreamer *streamer,
7676
static void bbstreamer_tar_terminator_finalize(bbstreamer *streamer);
7777
static void bbstreamer_tar_terminator_free(bbstreamer *streamer);
7878

79-
const bbstreamer_ops bbstreamer_tar_terminator_ops = {
79+
static const bbstreamer_ops bbstreamer_tar_terminator_ops = {
8080
.content = bbstreamer_tar_terminator_content,
8181
.finalize = bbstreamer_tar_terminator_finalize,
8282
.free = bbstreamer_tar_terminator_free

‎src/bin/pg_basebackup/bbstreamer_zstd.c

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/bbstreamer_zstd.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static void bbstreamer_zstd_compressor_content(bbstreamer *streamer,
3838
static void bbstreamer_zstd_compressor_finalize(bbstreamer *streamer);
3939
static void bbstreamer_zstd_compressor_free(bbstreamer *streamer);
4040

41-
const bbstreamer_ops bbstreamer_zstd_compressor_ops = {
41+
static const bbstreamer_ops bbstreamer_zstd_compressor_ops = {
4242
.content = bbstreamer_zstd_compressor_content,
4343
.finalize = bbstreamer_zstd_compressor_finalize,
4444
.free = bbstreamer_zstd_compressor_free
@@ -51,7 +51,7 @@ static void bbstreamer_zstd_decompressor_content(bbstreamer *streamer,
5151
static void bbstreamer_zstd_decompressor_finalize(bbstreamer *streamer);
5252
static void bbstreamer_zstd_decompressor_free(bbstreamer *streamer);
5353

54-
const bbstreamer_ops bbstreamer_zstd_decompressor_ops = {
54+
static const bbstreamer_ops bbstreamer_zstd_decompressor_ops = {
5555
.content = bbstreamer_zstd_decompressor_content,
5656
.finalize = bbstreamer_zstd_decompressor_finalize,
5757
.free = bbstreamer_zstd_decompressor_free

‎src/bin/pg_basebackup/walmethods.c

Copy file name to clipboardExpand all lines: src/bin/pg_basebackup/walmethods.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static int dir_sync(Walfile *f);
5555
static bool dir_finish(WalWriteMethod *wwmethod);
5656
static void dir_free(WalWriteMethod *wwmethod);
5757

58-
const WalWriteMethodOps WalDirectoryMethodOps = {
58+
static const WalWriteMethodOps WalDirectoryMethodOps = {
5959
.open_for_write = dir_open_for_write,
6060
.close = dir_close,
6161
.existsfile = dir_existsfile,
@@ -676,7 +676,7 @@ static int tar_sync(Walfile *f);
676676
static bool tar_finish(WalWriteMethod *wwmethod);
677677
static void tar_free(WalWriteMethod *wwmethod);
678678

679-
const WalWriteMethodOps WalTarMethodOps = {
679+
static const WalWriteMethodOps WalTarMethodOps = {
680680
.open_for_write = tar_open_for_write,
681681
.close = tar_close,
682682
.existsfile = tar_existsfile,

‎src/bin/pg_checksums/pg_checksums.c

Copy file name to clipboardExpand all lines: src/bin/pg_checksums/pg_checksums.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ static const char *progname;
6060
/*
6161
* Progress status information.
6262
*/
63-
int64 total_size = 0;
64-
int64 current_size = 0;
63+
static int64 total_size = 0;
64+
static int64 current_size = 0;
6565
static pg_time_t last_progress_report = 0;
6666

6767
static void

‎src/bin/pg_combinebackup/pg_combinebackup.c

Copy file name to clipboardExpand all lines: src/bin/pg_combinebackup/pg_combinebackup.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ typedef struct cb_tablespace
9797
} cb_tablespace;
9898

9999
/* Directories to be removed if we exit uncleanly. */
100-
cb_cleanup_dir *cleanup_dir_list = NULL;
100+
static cb_cleanup_dir *cleanup_dir_list = NULL;
101101

102102
static void add_tablespace_mapping(cb_options *opt, char *arg);
103103
static StringInfo check_backup_label_files(int n_backups, char **backup_dirs);

‎src/bin/pg_rewind/pg_rewind.c

Copy file name to clipboardExpand all lines: src/bin/pg_rewind/pg_rewind.c
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,21 @@ static ControlFileData ControlFile_target;
6060
static ControlFileData ControlFile_source;
6161
static ControlFileData ControlFile_source_after;
6262

63-
const char *progname;
63+
static const char *progname;
6464
int WalSegSz;
6565

6666
/* Configuration options */
6767
char *datadir_target = NULL;
68-
char *datadir_source = NULL;
69-
char *connstr_source = NULL;
70-
char *restore_command = NULL;
71-
char *config_file = NULL;
68+
static char *datadir_source = NULL;
69+
static char *connstr_source = NULL;
70+
static char *restore_command = NULL;
71+
static char *config_file = NULL;
7272

7373
static bool debug = false;
7474
bool showprogress = false;
7575
bool dry_run = false;
7676
bool do_sync = true;
77-
bool restore_wal = false;
77+
static bool restore_wal = false;
7878
DataDirSyncMethod sync_method = DATA_DIR_SYNC_METHOD_FSYNC;
7979

8080
/* Target history */

‎src/bin/pg_test_timing/pg_test_timing.c

Copy file name to clipboardExpand all lines: src/bin/pg_test_timing/pg_test_timing.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static uint64 test_timing(unsigned int duration);
2020
static void output(uint64 loop_count);
2121

2222
/* record duration in powers of 2 microseconds */
23-
long long int histogram[32];
23+
static long long int histogram[32];
2424

2525
int
2626
main(int argc, char *argv[])

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.