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
} event_trigger_command_tag_check_result;
/* 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},
{"AGGREGATE", true},
{"CAST", true},
check_ddl_tag(const char *tag)
{
const char *obtypename;
- event_trigger_support_data *etsd;
+ const event_trigger_support_data *etsd;
/*
* Handle some idiosyncratic special cases.
*
* 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},
{"service", ForeignServerRelationId},
{"user", UserMappingRelationId},
static bool
is_conninfo_option(const char *option, Oid context)
{
- struct ConnectionOption *opt;
+ const struct ConnectionOption *opt;
for (opt = libpq_conninfo_options; opt->optname; opt++)
if (context == opt->optcontext && strcmp(opt->optname, option) == 0)
if (!is_conninfo_option(def->defname, catalog))
{
- struct ConnectionOption *opt;
+ const struct ConnectionOption *opt;
StringInfoData buf;
/*
static int Setup_AF_UNIX(char *sock_path);
#endif /* HAVE_UNIX_SOCKETS */
-static PQcommMethods PqCommSocketMethods = {
+static const PQcommMethods PqCommSocketMethods = {
socket_comm_reset,
socket_flush,
socket_flush_if_writable,
socket_endcopyout
};
-PQcommMethods *PqCommMethods = &PqCommSocketMethods;
+const PQcommMethods *PqCommMethods = &PqCommSocketMethods;
WaitEventSet *FeBeWaitSet;
static void mq_startcopyout(void);
static void mq_endcopyout(bool errorAbort);
-static PQcommMethods PqCommMqMethods = {
+static const PQcommMethods PqCommMqMethods = {
mq_comm_reset,
mq_flush,
mq_flush_if_writable,
/*
* List of files excluded from checksum validation.
*/
-static const char *noChecksumFiles[] = {
+static const char *const noChecksumFiles[] = {
"pg_control",
"pg_filenode.map",
"pg_internal.init",
static bool
is_checksummed_file(const char *fullpath, const char *filename)
{
- const char **f;
+ const char *const *f;
/* Check that the file is in a tablespace */
if (strncmp(fullpath, "./global/", 9) == 0 ||
print $h "/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n";
print $c $autogen, "\n";
-print $c "char *MainLWLockNames[] = {";
+print $c "const char *const MainLWLockNames[] = {";
while (<$lwlocknames>)
{
num_word(Cash value)
{
static char buf[128];
- static const char *small[] = {
+ static const char *const small[] = {
"zero", "one", "two", "three", "four", "five", "six", "seven",
"eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
"fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty",
"thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"
};
- const char **big = small + 18;
+ const char *const *big = small + 18;
int tu = value % 100;
/* deal with the simple cases first */
void (*endcopyout) (bool errorAbort);
} PQcommMethods;
-extern PGDLLIMPORT PQcommMethods *PqCommMethods;
+extern const PGDLLIMPORT PQcommMethods *PqCommMethods;
#define pq_comm_reset() (PqCommMethods->comm_reset())
#define pq_flush() (PqCommMethods->flush())
} LWLockMinimallyPadded;
extern PGDLLIMPORT LWLockPadded *MainLWLockArray;
-extern char *MainLWLockNames[];
+extern const char *const MainLWLockNames[];
/* struct for storing named tranche information */
typedef struct NamedLWLockTranche