summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2023-09-26 10:28:57 +0000
committerPeter Eisentraut2023-09-26 10:28:57 +0000
commit64b787656de6c0c6f8f2e6e5b8a3cea25b92458b (patch)
treeeb873f33247043ee72e7172761d670a0829b148d
parenteddad679d2ab6d7369767d1c2f01fdbe76afbce3 (diff)
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]
-rw-r--r--contrib/fuzzystrmatch/fuzzystrmatch.c2
-rw-r--r--contrib/pgcrypto/pgp-armor.c4
-rw-r--r--src/backend/catalog/heap.c2
-rw-r--r--src/backend/utils/adt/ruleutils.c4
-rw-r--r--src/backend/utils/misc/guc.c4
-rw-r--r--src/bin/initdb/initdb.c4
-rw-r--r--src/bin/pg_amcheck/pg_amcheck.c2
-rw-r--r--src/bin/pg_rewind/filemap.c2
-rw-r--r--src/bin/pg_rewind/parsexlog.c2
-rw-r--r--src/bin/pgbench/pgbench.c4
-rw-r--r--src/interfaces/libpq/pqexpbuffer.c2
11 files changed, 16 insertions, 16 deletions
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c
index 56864979832..fc9cfbeda4b 100644
--- a/contrib/fuzzystrmatch/fuzzystrmatch.c
+++ b/contrib/fuzzystrmatch/fuzzystrmatch.c
@@ -55,7 +55,7 @@ static void _soundex(const char *instr, char *outstr);
#define SOUNDEX_LEN 4
/* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
-static const char *soundex_table = "01230120022455012623010202";
+static const char *const soundex_table = "01230120022455012623010202";
static char
soundex_code(char letter)
diff --git a/contrib/pgcrypto/pgp-armor.c b/contrib/pgcrypto/pgp-armor.c
index 9128756647c..bfc90af063d 100644
--- a/contrib/pgcrypto/pgp-armor.c
+++ b/contrib/pgcrypto/pgp-armor.c
@@ -178,8 +178,8 @@ pg_base64_dec_len(unsigned srclen)
* PGP armor
*/
-static const char *armor_header = "-----BEGIN PGP MESSAGE-----\n";
-static const char *armor_footer = "\n-----END PGP MESSAGE-----\n";
+static const char *const armor_header = "-----BEGIN PGP MESSAGE-----\n";
+static const char *const armor_footer = "\n-----END PGP MESSAGE-----\n";
/* CRC24 implementation from rfc2440 */
#define CRC24_INIT 0x00b704ceL
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index b42711f5744..d03c9616786 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -228,7 +228,7 @@ static const FormData_pg_attribute a6 = {
.attislocal = true,
};
-static const FormData_pg_attribute *SysAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6};
+static const FormData_pg_attribute *const SysAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6};
/*
* This function returns a Form_pg_attribute pointer for a system attribute.
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 68f301484e3..8d5eac47916 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -316,9 +316,9 @@ typedef void (*rsv_callback) (Node *node, deparse_context *context,
* ----------
*/
static SPIPlanPtr plan_getrulebyoid = NULL;
-static const char *query_getrulebyoid = "SELECT * FROM pg_catalog.pg_rewrite WHERE oid = $1";
+static const char *const query_getrulebyoid = "SELECT * FROM pg_catalog.pg_rewrite WHERE oid = $1";
static SPIPlanPtr plan_getviewrule = NULL;
-static const char *query_getviewrule = "SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2";
+static const char *const query_getviewrule = "SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2";
/* GUC parameters */
bool quote_all_identifiers = false;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 84e7ad4d907..c25c697a069 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -112,7 +112,7 @@ typedef struct
#error XLOG_BLCKSZ must be between 1KB and 1MB
#endif
-static const char *memory_units_hint = gettext_noop("Valid units for this parameter are \"B\", \"kB\", \"MB\", \"GB\", and \"TB\".");
+static const char *const memory_units_hint = gettext_noop("Valid units for this parameter are \"B\", \"kB\", \"MB\", \"GB\", and \"TB\".");
static const unit_conversion memory_unit_conversion_table[] =
{
@@ -149,7 +149,7 @@ static const unit_conversion memory_unit_conversion_table[] =
{""} /* end of table marker */
};
-static const char *time_units_hint = gettext_noop("Valid units for this parameter are \"us\", \"ms\", \"s\", \"min\", \"h\", and \"d\".");
+static const char *const time_units_hint = gettext_noop("Valid units for this parameter are \"us\", \"ms\", \"s\", \"min\", \"h\", and \"d\".");
static const unit_conversion time_unit_conversion_table[] =
{
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index bddb30d766c..0c6f5ceb0ac 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -218,8 +218,8 @@ static bool authwarning = false;
* but here it is more convenient to pass it as an environment variable
* (no quoting to worry about).
*/
-static const char *boot_options = "-F -c log_checkpoints=false";
-static const char *backend_options = "--single -F -O -j -c search_path=pg_catalog -c exit_on_error=true -c log_checkpoints=false";
+static const char *const boot_options = "-F -c log_checkpoints=false";
+static const char *const backend_options = "--single -F -O -j -c search_path=pg_catalog -c exit_on_error=true -c log_checkpoints=false";
/* Additional switches to pass to backend (either boot or standalone) */
static char *extra_options = "";
diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c
index 57df14bc1e0..8ac7051ff4d 100644
--- a/src/bin/pg_amcheck/pg_amcheck.c
+++ b/src/bin/pg_amcheck/pg_amcheck.c
@@ -166,7 +166,7 @@ typedef struct RelationInfo
* Query for determining if contrib's amcheck is installed. If so, selects the
* namespace name where amcheck's functions can be found.
*/
-static const char *amcheck_sql =
+static const char *const amcheck_sql =
"SELECT n.nspname, x.extversion FROM pg_catalog.pg_extension x"
"\nJOIN pg_catalog.pg_namespace n ON x.extnamespace = n.oid"
"\nWHERE x.extname = 'amcheck'";
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
index 58280d9abce..ecadd69dc53 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -85,7 +85,7 @@ struct exclude_list_item
* they are defined in backend-only headers. So this list is maintained
* with a best effort in mind.
*/
-static const char *excludeDirContents[] =
+static const char *const excludeDirContents[] =
{
/*
* Skip temporary statistics files. PG_STAT_TMP_DIR must be skipped
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index 27782237d05..0233ece88be 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -31,7 +31,7 @@
#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup,mask,decode) \
name,
-static const char *RmgrNames[RM_MAX_ID + 1] = {
+static const char *const RmgrNames[RM_MAX_ID + 1] = {
#include "access/rmgrlist.h"
};
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 713e8a06bb5..7a42fd00ee4 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -231,7 +231,7 @@ typedef enum
} partition_method_t;
static partition_method_t partition_method = PART_NONE;
-static const char *PARTITION_METHOD[] = {"none", "range", "hash"};
+static const char *const PARTITION_METHOD[] = {"none", "range", "hash"};
/* random seed used to initialize base_random_sequence */
int64 random_seed = -1;
@@ -709,7 +709,7 @@ typedef enum QueryMode
} QueryMode;
static QueryMode querymode = QUERY_SIMPLE;
-static const char *QUERYMODE[] = {"simple", "extended", "prepared"};
+static const char *const QUERYMODE[] = {"simple", "extended", "prepared"};
/*
* struct Command represents one command in a script.
diff --git a/src/interfaces/libpq/pqexpbuffer.c b/src/interfaces/libpq/pqexpbuffer.c
index de7e0328dbb..6d83014aab6 100644
--- a/src/interfaces/libpq/pqexpbuffer.c
+++ b/src/interfaces/libpq/pqexpbuffer.c
@@ -38,7 +38,7 @@
static const char oom_buffer[1] = "";
/* Need a char * for unconstify() compatibility */
-static const char *oom_buffer_ptr = oom_buffer;
+static const char *const oom_buffer_ptr = oom_buffer;
/*