Correct constness of a few variables.
This allows the compiler / linker to mark affected pages as read-only. There's other cases, but they're a bit more invasive, and should go through some review. These are easy. They were found with objdump -j .data -t src/backend/postgres|awk '{print $4, $5, $6}'|sort -r|less Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de
This commit is contained in:
parent
c5257345ef
commit
62649bad83
|
@ -85,7 +85,7 @@ typedef enum
|
||||||
} event_trigger_command_tag_check_result;
|
} event_trigger_command_tag_check_result;
|
||||||
|
|
||||||
/* XXX merge this with ObjectTypeMap? */
|
/* XXX merge this with ObjectTypeMap? */
|
||||||
static event_trigger_support_data event_trigger_support[] = {
|
static const event_trigger_support_data event_trigger_support[] = {
|
||||||
{"ACCESS METHOD", true},
|
{"ACCESS METHOD", true},
|
||||||
{"AGGREGATE", true},
|
{"AGGREGATE", true},
|
||||||
{"CAST", true},
|
{"CAST", true},
|
||||||
|
@ -282,7 +282,7 @@ static event_trigger_command_tag_check_result
|
||||||
check_ddl_tag(const char *tag)
|
check_ddl_tag(const char *tag)
|
||||||
{
|
{
|
||||||
const char *obtypename;
|
const char *obtypename;
|
||||||
event_trigger_support_data *etsd;
|
const event_trigger_support_data *etsd;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle some idiosyncratic special cases.
|
* Handle some idiosyncratic special cases.
|
||||||
|
|
|
@ -560,7 +560,7 @@ struct ConnectionOption
|
||||||
*
|
*
|
||||||
* The list is small - don't bother with bsearch if it stays so.
|
* The list is small - don't bother with bsearch if it stays so.
|
||||||
*/
|
*/
|
||||||
static struct ConnectionOption libpq_conninfo_options[] = {
|
static const struct ConnectionOption libpq_conninfo_options[] = {
|
||||||
{"authtype", ForeignServerRelationId},
|
{"authtype", ForeignServerRelationId},
|
||||||
{"service", ForeignServerRelationId},
|
{"service", ForeignServerRelationId},
|
||||||
{"user", UserMappingRelationId},
|
{"user", UserMappingRelationId},
|
||||||
|
@ -587,7 +587,7 @@ static struct ConnectionOption libpq_conninfo_options[] = {
|
||||||
static bool
|
static bool
|
||||||
is_conninfo_option(const char *option, Oid context)
|
is_conninfo_option(const char *option, Oid context)
|
||||||
{
|
{
|
||||||
struct ConnectionOption *opt;
|
const struct ConnectionOption *opt;
|
||||||
|
|
||||||
for (opt = libpq_conninfo_options; opt->optname; opt++)
|
for (opt = libpq_conninfo_options; opt->optname; opt++)
|
||||||
if (context == opt->optcontext && strcmp(opt->optname, option) == 0)
|
if (context == opt->optcontext && strcmp(opt->optname, option) == 0)
|
||||||
|
@ -622,7 +622,7 @@ postgresql_fdw_validator(PG_FUNCTION_ARGS)
|
||||||
|
|
||||||
if (!is_conninfo_option(def->defname, catalog))
|
if (!is_conninfo_option(def->defname, catalog))
|
||||||
{
|
{
|
||||||
struct ConnectionOption *opt;
|
const struct ConnectionOption *opt;
|
||||||
StringInfoData buf;
|
StringInfoData buf;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -170,7 +170,7 @@ static int Lock_AF_UNIX(char *unixSocketDir, char *unixSocketPath);
|
||||||
static int Setup_AF_UNIX(char *sock_path);
|
static int Setup_AF_UNIX(char *sock_path);
|
||||||
#endif /* HAVE_UNIX_SOCKETS */
|
#endif /* HAVE_UNIX_SOCKETS */
|
||||||
|
|
||||||
static PQcommMethods PqCommSocketMethods = {
|
static const PQcommMethods PqCommSocketMethods = {
|
||||||
socket_comm_reset,
|
socket_comm_reset,
|
||||||
socket_flush,
|
socket_flush,
|
||||||
socket_flush_if_writable,
|
socket_flush_if_writable,
|
||||||
|
@ -181,7 +181,7 @@ static PQcommMethods PqCommSocketMethods = {
|
||||||
socket_endcopyout
|
socket_endcopyout
|
||||||
};
|
};
|
||||||
|
|
||||||
PQcommMethods *PqCommMethods = &PqCommSocketMethods;
|
const PQcommMethods *PqCommMethods = &PqCommSocketMethods;
|
||||||
|
|
||||||
WaitEventSet *FeBeWaitSet;
|
WaitEventSet *FeBeWaitSet;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ static void mq_putmessage_noblock(char msgtype, const char *s, size_t len);
|
||||||
static void mq_startcopyout(void);
|
static void mq_startcopyout(void);
|
||||||
static void mq_endcopyout(bool errorAbort);
|
static void mq_endcopyout(bool errorAbort);
|
||||||
|
|
||||||
static PQcommMethods PqCommMqMethods = {
|
static const PQcommMethods PqCommMqMethods = {
|
||||||
mq_comm_reset,
|
mq_comm_reset,
|
||||||
mq_flush,
|
mq_flush,
|
||||||
mq_flush_if_writable,
|
mq_flush_if_writable,
|
||||||
|
|
|
@ -190,7 +190,7 @@ static const char *excludeFiles[] =
|
||||||
/*
|
/*
|
||||||
* List of files excluded from checksum validation.
|
* List of files excluded from checksum validation.
|
||||||
*/
|
*/
|
||||||
static const char *noChecksumFiles[] = {
|
static const char *const noChecksumFiles[] = {
|
||||||
"pg_control",
|
"pg_control",
|
||||||
"pg_filenode.map",
|
"pg_filenode.map",
|
||||||
"pg_internal.init",
|
"pg_internal.init",
|
||||||
|
@ -1321,7 +1321,7 @@ sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
|
||||||
static bool
|
static bool
|
||||||
is_checksummed_file(const char *fullpath, const char *filename)
|
is_checksummed_file(const char *fullpath, const char *filename)
|
||||||
{
|
{
|
||||||
const char **f;
|
const char *const *f;
|
||||||
|
|
||||||
/* Check that the file is in a tablespace */
|
/* Check that the file is in a tablespace */
|
||||||
if (strncmp(fullpath, "./global/", 9) == 0 ||
|
if (strncmp(fullpath, "./global/", 9) == 0 ||
|
||||||
|
|
|
@ -23,7 +23,7 @@ print $h $autogen;
|
||||||
print $h "/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n";
|
print $h "/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n";
|
||||||
print $c $autogen, "\n";
|
print $c $autogen, "\n";
|
||||||
|
|
||||||
print $c "char *MainLWLockNames[] = {";
|
print $c "const char *const MainLWLockNames[] = {";
|
||||||
|
|
||||||
while (<$lwlocknames>)
|
while (<$lwlocknames>)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,13 +39,13 @@ static const char *
|
||||||
num_word(Cash value)
|
num_word(Cash value)
|
||||||
{
|
{
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
static const char *small[] = {
|
static const char *const small[] = {
|
||||||
"zero", "one", "two", "three", "four", "five", "six", "seven",
|
"zero", "one", "two", "three", "four", "five", "six", "seven",
|
||||||
"eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
|
"eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
|
||||||
"fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty",
|
"fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty",
|
||||||
"thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"
|
"thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"
|
||||||
};
|
};
|
||||||
const char **big = small + 18;
|
const char *const *big = small + 18;
|
||||||
int tu = value % 100;
|
int tu = value % 100;
|
||||||
|
|
||||||
/* deal with the simple cases first */
|
/* deal with the simple cases first */
|
||||||
|
|
|
@ -33,7 +33,7 @@ typedef struct
|
||||||
void (*endcopyout) (bool errorAbort);
|
void (*endcopyout) (bool errorAbort);
|
||||||
} PQcommMethods;
|
} PQcommMethods;
|
||||||
|
|
||||||
extern PGDLLIMPORT PQcommMethods *PqCommMethods;
|
extern const PGDLLIMPORT PQcommMethods *PqCommMethods;
|
||||||
|
|
||||||
#define pq_comm_reset() (PqCommMethods->comm_reset())
|
#define pq_comm_reset() (PqCommMethods->comm_reset())
|
||||||
#define pq_flush() (PqCommMethods->flush())
|
#define pq_flush() (PqCommMethods->flush())
|
||||||
|
|
|
@ -88,7 +88,7 @@ typedef union LWLockMinimallyPadded
|
||||||
} LWLockMinimallyPadded;
|
} LWLockMinimallyPadded;
|
||||||
|
|
||||||
extern PGDLLIMPORT LWLockPadded *MainLWLockArray;
|
extern PGDLLIMPORT LWLockPadded *MainLWLockArray;
|
||||||
extern char *MainLWLockNames[];
|
extern const char *const MainLWLockNames[];
|
||||||
|
|
||||||
/* struct for storing named tranche information */
|
/* struct for storing named tranche information */
|
||||||
typedef struct NamedLWLockTranche
|
typedef struct NamedLWLockTranche
|
||||||
|
|
Loading…
Reference in New Issue