Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64b7876

Browse files
committed
Add some const qualifiers
There was a mismatch between the const qualifiers for excludeDirContents in src/backend/backup/basebackup.c and src/bin/pg_rewind/filemap.c, which led to a quick search for similar cases. We should make excludeDirContents match, but the rest of the changes seem like a good idea as well. Author: David Steele <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/[email protected]
1 parent eddad67 commit 64b7876

File tree

11 files changed

+16
-16
lines changed

11 files changed

+16
-16
lines changed

contrib/fuzzystrmatch/fuzzystrmatch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void _soundex(const char *instr, char *outstr);
5555
#define SOUNDEX_LEN 4
5656

5757
/* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
58-
static const char *soundex_table = "01230120022455012623010202";
58+
static const char *const soundex_table = "01230120022455012623010202";
5959

6060
static char
6161
soundex_code(char letter)

contrib/pgcrypto/pgp-armor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ pg_base64_dec_len(unsigned srclen)
178178
* PGP armor
179179
*/
180180

181-
static const char *armor_header = "-----BEGIN PGP MESSAGE-----\n";
182-
static const char *armor_footer = "\n-----END PGP MESSAGE-----\n";
181+
static const char *const armor_header = "-----BEGIN PGP MESSAGE-----\n";
182+
static const char *const armor_footer = "\n-----END PGP MESSAGE-----\n";
183183

184184
/* CRC24 implementation from rfc2440 */
185185
#define CRC24_INIT 0x00b704ceL

src/backend/catalog/heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static const FormData_pg_attribute a6 = {
228228
.attislocal = true,
229229
};
230230

231-
static const FormData_pg_attribute *SysAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6};
231+
static const FormData_pg_attribute *const SysAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6};
232232

233233
/*
234234
* This function returns a Form_pg_attribute pointer for a system attribute.

src/backend/utils/adt/ruleutils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ typedef void (*rsv_callback) (Node *node, deparse_context *context,
316316
* ----------
317317
*/
318318
static SPIPlanPtr plan_getrulebyoid = NULL;
319-
static const char *query_getrulebyoid = "SELECT * FROM pg_catalog.pg_rewrite WHERE oid = $1";
319+
static const char *const query_getrulebyoid = "SELECT * FROM pg_catalog.pg_rewrite WHERE oid = $1";
320320
static SPIPlanPtr plan_getviewrule = NULL;
321-
static const char *query_getviewrule = "SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2";
321+
static const char *const query_getviewrule = "SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2";
322322

323323
/* GUC parameters */
324324
bool quote_all_identifiers = false;

src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ typedef struct
112112
#error XLOG_BLCKSZ must be between 1KB and 1MB
113113
#endif
114114

115-
static const char *memory_units_hint = gettext_noop("Valid units for this parameter are \"B\", \"kB\", \"MB\", \"GB\", and \"TB\".");
115+
static const char *const memory_units_hint = gettext_noop("Valid units for this parameter are \"B\", \"kB\", \"MB\", \"GB\", and \"TB\".");
116116

117117
static const unit_conversion memory_unit_conversion_table[] =
118118
{
@@ -149,7 +149,7 @@ static const unit_conversion memory_unit_conversion_table[] =
149149
{""} /* end of table marker */
150150
};
151151

152-
static const char *time_units_hint = gettext_noop("Valid units for this parameter are \"us\", \"ms\", \"s\", \"min\", \"h\", and \"d\".");
152+
static const char *const time_units_hint = gettext_noop("Valid units for this parameter are \"us\", \"ms\", \"s\", \"min\", \"h\", and \"d\".");
153153

154154
static const unit_conversion time_unit_conversion_table[] =
155155
{

src/bin/initdb/initdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ static bool authwarning = false;
218218
* but here it is more convenient to pass it as an environment variable
219219
* (no quoting to worry about).
220220
*/
221-
static const char *boot_options = "-F -c log_checkpoints=false";
222-
static const char *backend_options = "--single -F -O -j -c search_path=pg_catalog -c exit_on_error=true -c log_checkpoints=false";
221+
static const char *const boot_options = "-F -c log_checkpoints=false";
222+
static const char *const backend_options = "--single -F -O -j -c search_path=pg_catalog -c exit_on_error=true -c log_checkpoints=false";
223223

224224
/* Additional switches to pass to backend (either boot or standalone) */
225225
static char *extra_options = "";

src/bin/pg_amcheck/pg_amcheck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ typedef struct RelationInfo
166166
* Query for determining if contrib's amcheck is installed. If so, selects the
167167
* namespace name where amcheck's functions can be found.
168168
*/
169-
static const char *amcheck_sql =
169+
static const char *const amcheck_sql =
170170
"SELECT n.nspname, x.extversion FROM pg_catalog.pg_extension x"
171171
"\nJOIN pg_catalog.pg_namespace n ON x.extnamespace = n.oid"
172172
"\nWHERE x.extname = 'amcheck'";

src/bin/pg_rewind/filemap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct exclude_list_item
8585
* they are defined in backend-only headers. So this list is maintained
8686
* with a best effort in mind.
8787
*/
88-
static const char *excludeDirContents[] =
88+
static const char *const excludeDirContents[] =
8989
{
9090
/*
9191
* Skip temporary statistics files. PG_STAT_TMP_DIR must be skipped

src/bin/pg_rewind/parsexlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup,mask,decode) \
3232
name,
3333

34-
static const char *RmgrNames[RM_MAX_ID + 1] = {
34+
static const char *const RmgrNames[RM_MAX_ID + 1] = {
3535
#include "access/rmgrlist.h"
3636
};
3737

src/bin/pgbench/pgbench.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ typedef enum
231231
} partition_method_t;
232232

233233
static partition_method_t partition_method = PART_NONE;
234-
static const char *PARTITION_METHOD[] = {"none", "range", "hash"};
234+
static const char *const PARTITION_METHOD[] = {"none", "range", "hash"};
235235

236236
/* random seed used to initialize base_random_sequence */
237237
int64 random_seed = -1;
@@ -709,7 +709,7 @@ typedef enum QueryMode
709709
} QueryMode;
710710

711711
static QueryMode querymode = QUERY_SIMPLE;
712-
static const char *QUERYMODE[] = {"simple", "extended", "prepared"};
712+
static const char *const QUERYMODE[] = {"simple", "extended", "prepared"};
713713

714714
/*
715715
* struct Command represents one command in a script.

src/interfaces/libpq/pqexpbuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
static const char oom_buffer[1] = "";
3939

4040
/* Need a char * for unconstify() compatibility */
41-
static const char *oom_buffer_ptr = oom_buffer;
41+
static const char *const oom_buffer_ptr = oom_buffer;
4242

4343

4444
/*

0 commit comments

Comments
 (0)