Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62649ba

Browse files
committed
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 gothrough some review. These are easy.They were found withobjdump -j .data -t src/backend/postgres|awk '{print $4, $5, $6}'|sort -r|lessDiscussion:https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de
1 parentc525734 commit62649ba

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

‎src/backend/commands/event_trigger.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ typedef enum
8585
}event_trigger_command_tag_check_result;
8686

8787
/* XXX merge this with ObjectTypeMap? */
88-
staticevent_trigger_support_dataevent_trigger_support[]= {
88+
staticconstevent_trigger_support_dataevent_trigger_support[]= {
8989
{"ACCESS METHOD", true},
9090
{"AGGREGATE", true},
9191
{"CAST", true},
@@ -282,7 +282,7 @@ static event_trigger_command_tag_check_result
282282
check_ddl_tag(constchar*tag)
283283
{
284284
constchar*obtypename;
285-
event_trigger_support_data*etsd;
285+
constevent_trigger_support_data*etsd;
286286

287287
/*
288288
* Handle some idiosyncratic special cases.

‎src/backend/foreign/foreign.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ struct ConnectionOption
560560
*
561561
* The list is small - don't bother with bsearch if it stays so.
562562
*/
563-
staticstructConnectionOptionlibpq_conninfo_options[]= {
563+
staticconststructConnectionOptionlibpq_conninfo_options[]= {
564564
{"authtype",ForeignServerRelationId},
565565
{"service",ForeignServerRelationId},
566566
{"user",UserMappingRelationId},
@@ -587,7 +587,7 @@ static struct ConnectionOption libpq_conninfo_options[] = {
587587
staticbool
588588
is_conninfo_option(constchar*option,Oidcontext)
589589
{
590-
structConnectionOption*opt;
590+
conststructConnectionOption*opt;
591591

592592
for (opt=libpq_conninfo_options;opt->optname;opt++)
593593
if (context==opt->optcontext&&strcmp(opt->optname,option)==0)
@@ -622,7 +622,7 @@ postgresql_fdw_validator(PG_FUNCTION_ARGS)
622622

623623
if (!is_conninfo_option(def->defname,catalog))
624624
{
625-
structConnectionOption*opt;
625+
conststructConnectionOption*opt;
626626
StringInfoDatabuf;
627627

628628
/*

‎src/backend/libpq/pqcomm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static intLock_AF_UNIX(char *unixSocketDir, char *unixSocketPath);
170170
staticintSetup_AF_UNIX(char*sock_path);
171171
#endif/* HAVE_UNIX_SOCKETS */
172172

173-
staticPQcommMethodsPqCommSocketMethods= {
173+
staticconstPQcommMethodsPqCommSocketMethods= {
174174
socket_comm_reset,
175175
socket_flush,
176176
socket_flush_if_writable,
@@ -181,7 +181,7 @@ static PQcommMethods PqCommSocketMethods = {
181181
socket_endcopyout
182182
};
183183

184-
PQcommMethods*PqCommMethods=&PqCommSocketMethods;
184+
constPQcommMethods*PqCommMethods=&PqCommSocketMethods;
185185

186186
WaitEventSet*FeBeWaitSet;
187187

‎src/backend/libpq/pqmq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void mq_putmessage_noblock(char msgtype, const char *s, size_t len);
3636
staticvoidmq_startcopyout(void);
3737
staticvoidmq_endcopyout(boolerrorAbort);
3838

39-
staticPQcommMethodsPqCommMqMethods= {
39+
staticconstPQcommMethodsPqCommMqMethods= {
4040
mq_comm_reset,
4141
mq_flush,
4242
mq_flush_if_writable,

‎src/backend/replication/basebackup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static const char *excludeFiles[] =
190190
/*
191191
* List of files excluded from checksum validation.
192192
*/
193-
staticconstchar*noChecksumFiles[]= {
193+
staticconstchar*constnoChecksumFiles[]= {
194194
"pg_control",
195195
"pg_filenode.map",
196196
"pg_internal.init",
@@ -1321,7 +1321,7 @@ sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
13211321
staticbool
13221322
is_checksummed_file(constchar*fullpath,constchar*filename)
13231323
{
1324-
constchar**f;
1324+
constchar*const*f;
13251325

13261326
/* Check that the file is in a tablespace */
13271327
if (strncmp(fullpath,"./global/",9)==0||

‎src/backend/storage/lmgr/generate-lwlocknames.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
print$h"/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n";
2424
print$c$autogen,"\n";
2525

26-
print$c"char *MainLWLockNames[] = {";
26+
print$c"constchar *constMainLWLockNames[] = {";
2727

2828
while (<$lwlocknames>)
2929
{

‎src/backend/utils/adt/cash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ static const char *
3939
num_word(Cashvalue)
4040
{
4141
staticcharbuf[128];
42-
staticconstchar*small[]= {
42+
staticconstchar*constsmall[]= {
4343
"zero","one","two","three","four","five","six","seven",
4444
"eight","nine","ten","eleven","twelve","thirteen","fourteen",
4545
"fifteen","sixteen","seventeen","eighteen","nineteen","twenty",
4646
"thirty","forty","fifty","sixty","seventy","eighty","ninety"
4747
};
48-
constchar**big=small+18;
48+
constchar*const*big=small+18;
4949
inttu=value %100;
5050

5151
/* deal with the simple cases first */

‎src/include/libpq/libpq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ typedef struct
3333
void(*endcopyout) (boolerrorAbort);
3434
}PQcommMethods;
3535

36-
externPGDLLIMPORTPQcommMethods*PqCommMethods;
36+
externconstPGDLLIMPORTPQcommMethods*PqCommMethods;
3737

3838
#definepq_comm_reset() (PqCommMethods->comm_reset())
3939
#definepq_flush() (PqCommMethods->flush())

‎src/include/storage/lwlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ typedef union LWLockMinimallyPadded
8888
}LWLockMinimallyPadded;
8989

9090
externPGDLLIMPORTLWLockPadded*MainLWLockArray;
91-
externchar*MainLWLockNames[];
91+
externconstchar*constMainLWLockNames[];
9292

9393
/* struct for storing named tranche information */
9494
typedefstructNamedLWLockTranche

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp