Skip to content

Commit 6521cd9

Browse files
committed
Add 'static' to initdb.c file-global variables.
1 parent c5159bc commit 6521cd9

File tree

1 file changed

+47
-49
lines changed

1 file changed

+47
-49
lines changed

src/bin/initdb/initdb.c

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Portions Copyright (c) 1994, Regents of the University of California
4040
* Portions taken from FreeBSD.
4141
*
42-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.77 2005/03/07 04:30:55 momjian Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.78 2005/03/11 15:36:27 momjian Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -71,62 +71,60 @@ int optreset;
7171
/*
7272
* these values are passed in by makefile defines
7373
*/
74-
char *share_path = NULL;
74+
static char *share_path = NULL;
7575

7676
/* values to be obtained from arguments */
77-
char *pg_data = "";
78-
char *encoding = "";
79-
char *locale = "";
80-
char *lc_collate = "";
81-
char *lc_ctype = "";
82-
char *lc_monetary = "";
83-
char *lc_numeric = "";
84-
char *lc_time = "";
85-
char *lc_messages = "";
86-
char *username = "";
87-
bool pwprompt = false;
88-
char *pwfilename = NULL;
89-
char *authmethod = "";
90-
bool debug = false;
91-
bool noclean = false;
92-
bool show_setting = false;
77+
static char *pg_data = "";
78+
static char *encoding = "";
79+
static char *locale = "";
80+
static char *lc_collate = "";
81+
static char *lc_ctype = "";
82+
static char *lc_monetary = "";
83+
static char *lc_numeric = "";
84+
static char *lc_time = "";
85+
static char *lc_messages = "";
86+
static char *username = "";
87+
static bool pwprompt = false;
88+
static char *pwfilename = NULL;
89+
static char *authmethod = "";
90+
static bool debug = false;
91+
static bool noclean = false;
92+
static bool show_setting = false;
9393

9494

9595
/* internal vars */
96-
const char *progname;
97-
char *postgres;
98-
char *encodingid = "0";
99-
char *bki_file;
100-
char *desc_file;
101-
char *hba_file;
102-
char *ident_file;
103-
char *conf_file;
104-
char *conversion_file;
105-
char *info_schema_file;
106-
char *features_file;
107-
char *system_views_file;
108-
char *effective_user;
109-
bool testpath = true;
110-
bool made_new_pgdata = false;
111-
bool found_existing_pgdata = false;
112-
char infoversion[100];
113-
bool caught_signal = false;
114-
bool output_failed = false;
115-
int output_errno = 0;
96+
static const char *progname;
97+
static char *encodingid = "0";
98+
static char *bki_file;
99+
static char *desc_file;
100+
static char *hba_file;
101+
static char *ident_file;
102+
static char *conf_file;
103+
static char *conversion_file;
104+
static char *info_schema_file;
105+
static char *features_file;
106+
static char *system_views_file;
107+
static char *effective_user;
108+
static bool made_new_pgdata = false;
109+
static bool found_existing_pgdata = false;
110+
static char infoversion[100];
111+
static bool caught_signal = false;
112+
static bool output_failed = false;
113+
static int output_errno = 0;
116114

117115
/* defaults */
118-
int n_connections = 10;
119-
int n_buffers = 50;
116+
static int n_connections = 10;
117+
static int n_buffers = 50;
120118

121119
/*
122120
* Warning messages for authentication methods
123121
*/
124-
char *authtrust_warning = \
125-
"# CAUTION: Configuring the system for local \"trust\" authentication allows\n"
126-
"# any local user to connect as any PostgreSQL user, including the database\n"
127-
"# superuser. If you do not trust all your local users, use another\n"
128-
"# authentication method.\n";
129-
char *authwarning = NULL;
122+
#define AUTHTRUST_WARNING \
123+
"# CAUTION: Configuring the system for local \"trust\" authentication allows\n" \
124+
"# any local user to connect as any PostgreSQL user, including the database\n" \
125+
"# superuser. If you do not trust all your local users, use another\n" \
126+
"# authentication method.\n"
127+
static char *authwarning = NULL;
130128

131129
/*
132130
* Centralized knowledge of switches to pass to backend
@@ -140,8 +138,8 @@ static const char *backend_options = "-F -O -c search_path=pg_catalog -c exit_on
140138

141139

142140
/* path to 'initdb' binary directory */
143-
char bin_path[MAXPGPATH];
144-
char backend_exec[MAXPGPATH];
141+
static char bin_path[MAXPGPATH];
142+
static char backend_exec[MAXPGPATH];
145143

146144
static void *xmalloc(size_t size);
147145
static char *xstrdup(const char *s);
@@ -1210,7 +1208,7 @@ setup_config(void)
12101208

12111209
conflines = replace_token(conflines,
12121210
"@authcomment@",
1213-
strcmp(authmethod, "trust") ? "" : authtrust_warning);
1211+
strcmp(authmethod, "trust") ? "" : AUTHTRUST_WARNING);
12141212

12151213
snprintf(path, sizeof(path), "%s/pg_hba.conf", pg_data);
12161214

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy