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 <david@pgmasters.net>
Discussion: https://www.postgresql.org/message-id/flat/669a035c-d23d-2f38-7ff0-0cb93e01d610@pgmasters.net
This commit is contained in:
Peter Eisentraut 2023-09-26 11:28:57 +01:00
parent eddad679d2
commit 64b787656d
11 changed files with 16 additions and 16 deletions

View File

@ -55,7 +55,7 @@ static void _soundex(const char *instr, char *outstr);
#define SOUNDEX_LEN 4 #define SOUNDEX_LEN 4
/* ABCDEFGHIJKLMNOPQRSTUVWXYZ */ /* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
static const char *soundex_table = "01230120022455012623010202"; static const char *const soundex_table = "01230120022455012623010202";
static char static char
soundex_code(char letter) soundex_code(char letter)

View File

@ -178,8 +178,8 @@ pg_base64_dec_len(unsigned srclen)
* PGP armor * PGP armor
*/ */
static const char *armor_header = "-----BEGIN PGP MESSAGE-----\n"; static const char *const armor_header = "-----BEGIN PGP MESSAGE-----\n";
static const char *armor_footer = "\n-----END PGP MESSAGE-----\n"; static const char *const armor_footer = "\n-----END PGP MESSAGE-----\n";
/* CRC24 implementation from rfc2440 */ /* CRC24 implementation from rfc2440 */
#define CRC24_INIT 0x00b704ceL #define CRC24_INIT 0x00b704ceL

View File

@ -228,7 +228,7 @@ static const FormData_pg_attribute a6 = {
.attislocal = true, .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. * This function returns a Form_pg_attribute pointer for a system attribute.

View File

@ -316,9 +316,9 @@ typedef void (*rsv_callback) (Node *node, deparse_context *context,
* ---------- * ----------
*/ */
static SPIPlanPtr plan_getrulebyoid = NULL; 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 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 */ /* GUC parameters */
bool quote_all_identifiers = false; bool quote_all_identifiers = false;

View File

@ -112,7 +112,7 @@ typedef struct
#error XLOG_BLCKSZ must be between 1KB and 1MB #error XLOG_BLCKSZ must be between 1KB and 1MB
#endif #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[] = static const unit_conversion memory_unit_conversion_table[] =
{ {
@ -149,7 +149,7 @@ static const unit_conversion memory_unit_conversion_table[] =
{""} /* end of table marker */ {""} /* 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[] = static const unit_conversion time_unit_conversion_table[] =
{ {

View File

@ -218,8 +218,8 @@ static bool authwarning = false;
* but here it is more convenient to pass it as an environment variable * but here it is more convenient to pass it as an environment variable
* (no quoting to worry about). * (no quoting to worry about).
*/ */
static const char *boot_options = "-F -c log_checkpoints=false"; static const char *const 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 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) */ /* Additional switches to pass to backend (either boot or standalone) */
static char *extra_options = ""; static char *extra_options = "";

View File

@ -166,7 +166,7 @@ typedef struct RelationInfo
* Query for determining if contrib's amcheck is installed. If so, selects the * Query for determining if contrib's amcheck is installed. If so, selects the
* namespace name where amcheck's functions can be found. * 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" "SELECT n.nspname, x.extversion FROM pg_catalog.pg_extension x"
"\nJOIN pg_catalog.pg_namespace n ON x.extnamespace = n.oid" "\nJOIN pg_catalog.pg_namespace n ON x.extnamespace = n.oid"
"\nWHERE x.extname = 'amcheck'"; "\nWHERE x.extname = 'amcheck'";

View File

@ -85,7 +85,7 @@ struct exclude_list_item
* they are defined in backend-only headers. So this list is maintained * they are defined in backend-only headers. So this list is maintained
* with a best effort in mind. * 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 * Skip temporary statistics files. PG_STAT_TMP_DIR must be skipped

View File

@ -31,7 +31,7 @@
#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup,mask,decode) \ #define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup,mask,decode) \
name, name,
static const char *RmgrNames[RM_MAX_ID + 1] = { static const char *const RmgrNames[RM_MAX_ID + 1] = {
#include "access/rmgrlist.h" #include "access/rmgrlist.h"
}; };

View File

@ -231,7 +231,7 @@ typedef enum
} partition_method_t; } partition_method_t;
static partition_method_t partition_method = PART_NONE; 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 */ /* random seed used to initialize base_random_sequence */
int64 random_seed = -1; int64 random_seed = -1;
@ -709,7 +709,7 @@ typedef enum QueryMode
} QueryMode; } QueryMode;
static QueryMode querymode = QUERY_SIMPLE; 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. * struct Command represents one command in a script.

View File

@ -38,7 +38,7 @@
static const char oom_buffer[1] = ""; static const char oom_buffer[1] = "";
/* Need a char * for unconstify() compatibility */ /* Need a char * for unconstify() compatibility */
static const char *oom_buffer_ptr = oom_buffer; static const char *const oom_buffer_ptr = oom_buffer;
/* /*