mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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:
		@@ -85,7 +85,7 @@ typedef enum
 | 
			
		||||
} 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},
 | 
			
		||||
@@ -282,7 +282,7 @@ static event_trigger_command_tag_check_result
 | 
			
		||||
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.
 | 
			
		||||
 
 | 
			
		||||
@@ -560,7 +560,7 @@ struct ConnectionOption
 | 
			
		||||
 *
 | 
			
		||||
 * 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},
 | 
			
		||||
@@ -587,7 +587,7 @@ static struct ConnectionOption libpq_conninfo_options[] = {
 | 
			
		||||
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)
 | 
			
		||||
@@ -622,7 +622,7 @@ postgresql_fdw_validator(PG_FUNCTION_ARGS)
 | 
			
		||||
 | 
			
		||||
		if (!is_conninfo_option(def->defname, catalog))
 | 
			
		||||
		{
 | 
			
		||||
			struct ConnectionOption *opt;
 | 
			
		||||
			const struct ConnectionOption *opt;
 | 
			
		||||
			StringInfoData buf;
 | 
			
		||||
 | 
			
		||||
			/*
 | 
			
		||||
 
 | 
			
		||||
@@ -170,7 +170,7 @@ static int	Lock_AF_UNIX(char *unixSocketDir, char *unixSocketPath);
 | 
			
		||||
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,
 | 
			
		||||
@@ -181,7 +181,7 @@ static PQcommMethods PqCommSocketMethods = {
 | 
			
		||||
	socket_endcopyout
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
PQcommMethods *PqCommMethods = &PqCommSocketMethods;
 | 
			
		||||
const PQcommMethods *PqCommMethods = &PqCommSocketMethods;
 | 
			
		||||
 | 
			
		||||
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_endcopyout(bool errorAbort);
 | 
			
		||||
 | 
			
		||||
static PQcommMethods PqCommMqMethods = {
 | 
			
		||||
static const PQcommMethods PqCommMqMethods = {
 | 
			
		||||
	mq_comm_reset,
 | 
			
		||||
	mq_flush,
 | 
			
		||||
	mq_flush_if_writable,
 | 
			
		||||
 
 | 
			
		||||
@@ -190,7 +190,7 @@ static const char *excludeFiles[] =
 | 
			
		||||
/*
 | 
			
		||||
 * List of files excluded from checksum validation.
 | 
			
		||||
 */
 | 
			
		||||
static const char *noChecksumFiles[] = {
 | 
			
		||||
static const char *const noChecksumFiles[] = {
 | 
			
		||||
	"pg_control",
 | 
			
		||||
	"pg_filenode.map",
 | 
			
		||||
	"pg_internal.init",
 | 
			
		||||
@@ -1321,7 +1321,7 @@ sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
 | 
			
		||||
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 ||
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ print $h $autogen;
 | 
			
		||||
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>)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -39,13 +39,13 @@ static const char *
 | 
			
		||||
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 */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user