Skip to content

Commit 0e1539b

Browse files
committed
Add some const decorations to prototypes
Reviewed-by: Fabien COELHO <[email protected]>
1 parent 7e60e67 commit 0e1539b

File tree

95 files changed

+236
-236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+236
-236
lines changed

contrib/dict_xsyn/dict_xsyn.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ compare_syn(const void *a, const void *b)
7070
}
7171

7272
static void
73-
read_dictionary(DictSyn *d, char *filename)
73+
read_dictionary(DictSyn *d, const char *filename)
7474
{
7575
char *real_filename = get_tsearch_config_filename(filename, "rules");
7676
tsearch_readline_state trst;

contrib/fuzzystrmatch/dmetaphone.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ metastring;
232232
*/
233233

234234
static metastring *
235-
NewMetaString(char *init_str)
235+
NewMetaString(const char *init_str)
236236
{
237237
metastring *s;
238238
char empty_string[] = "";
@@ -375,7 +375,7 @@ StringAt(metastring *s, int start, int length,...)
375375

376376

377377
static void
378-
MetaphAdd(metastring *s, char *new_str)
378+
MetaphAdd(metastring *s, const char *new_str)
379379
{
380380
int add_length;
381381

contrib/pgcrypto/pgcrypto.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ PG_MODULE_MAGIC;
4747
/* private stuff */
4848

4949
typedef int (*PFN) (const char *name, void **res);
50-
static void *find_provider(text *name, PFN pf, char *desc, int silent);
50+
static void *find_provider(text *name, PFN pf, const char *desc, int silent);
5151

5252
/* SQL function: hash(bytea, text) returns bytea */
5353
PG_FUNCTION_INFO_V1(pg_digest);
@@ -474,7 +474,7 @@ pg_random_uuid(PG_FUNCTION_ARGS)
474474
static void *
475475
find_provider(text *name,
476476
PFN provider_lookup,
477-
char *desc, int silent)
477+
const char *desc, int silent)
478478
{
479479
void *res;
480480
char *buf;

contrib/seg/seg.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1052,9 +1052,9 @@ restore(char *result, float val, int n)
10521052
* a floating point number
10531053
*/
10541054
int
1055-
significant_digits(char *s)
1055+
significant_digits(const char *s)
10561056
{
1057-
char *p = s;
1057+
const char *p = s;
10581058
int n,
10591059
c,
10601060
zeroes;

contrib/seg/segdata.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ typedef struct SEG
1212
} SEG;
1313

1414
/* in seg.c */
15-
extern int significant_digits(char *str);
15+
extern int significant_digits(const char *str);
1616

1717
/* in segscan.l */
1818
extern int seg_yylex(void);

contrib/seg/segparse.y

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#define YYMALLOC palloc
2222
#define YYFREE pfree
2323

24-
static float seg_atof(char *value);
24+
static float seg_atof(const char *value);
2525

2626
static char strbuf[25] = {
2727
'0', '0', '0', '0', '0',
@@ -151,7 +151,7 @@ deviation: SEGFLOAT
151151

152152

153153
static float
154-
seg_atof(char *value)
154+
seg_atof(const char *value)
155155
{
156156
Datum datum;
157157

contrib/unaccent/unaccent.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ placeChar(TrieChar *node, const unsigned char *str, int lenstr,
9090
* Function converts UTF8-encoded file into current encoding.
9191
*/
9292
static TrieChar *
93-
initTrie(char *filename)
93+
initTrie(const char *filename)
9494
{
9595
TrieChar *volatile rootTrie = NULL;
9696
MemoryContext ccxt = CurrentMemoryContext;

contrib/uuid-ossp/uuid-ossp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ uuid_generate_v35_internal(int mode, pg_uuid_t *ns, text *name)
253253
#else /* !HAVE_UUID_OSSP */
254254

255255
static Datum
256-
uuid_generate_internal(int v, unsigned char *ns, char *ptr, int len)
256+
uuid_generate_internal(int v, unsigned char *ns, const char *ptr, int len)
257257
{
258258
char strbuf[40];
259259

src/backend/access/common/reloptions.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ add_reloption(relopt_gen *newoption)
582582
* (for types other than string)
583583
*/
584584
static relopt_gen *
585-
allocate_reloption(bits32 kinds, int type, char *name, char *desc)
585+
allocate_reloption(bits32 kinds, int type, const char *name, const char *desc)
586586
{
587587
MemoryContext oldcxt;
588588
size_t size;
@@ -630,7 +630,7 @@ allocate_reloption(bits32 kinds, int type, char *name, char *desc)
630630
* Add a new boolean reloption
631631
*/
632632
void
633-
add_bool_reloption(bits32 kinds, char *name, char *desc, bool default_val)
633+
add_bool_reloption(bits32 kinds, const char *name, const char *desc, bool default_val)
634634
{
635635
relopt_bool *newoption;
636636

@@ -646,7 +646,7 @@ add_bool_reloption(bits32 kinds, char *name, char *desc, bool default_val)
646646
* Add a new integer reloption
647647
*/
648648
void
649-
add_int_reloption(bits32 kinds, char *name, char *desc, int default_val,
649+
add_int_reloption(bits32 kinds, const char *name, const char *desc, int default_val,
650650
int min_val, int max_val)
651651
{
652652
relopt_int *newoption;
@@ -665,7 +665,7 @@ add_int_reloption(bits32 kinds, char *name, char *desc, int default_val,
665665
* Add a new float reloption
666666
*/
667667
void
668-
add_real_reloption(bits32 kinds, char *name, char *desc, double default_val,
668+
add_real_reloption(bits32 kinds, const char *name, const char *desc, double default_val,
669669
double min_val, double max_val)
670670
{
671671
relopt_real *newoption;
@@ -689,7 +689,7 @@ add_real_reloption(bits32 kinds, char *name, char *desc, double default_val,
689689
* the validation.
690690
*/
691691
void
692-
add_string_reloption(bits32 kinds, char *name, char *desc, char *default_val,
692+
add_string_reloption(bits32 kinds, const char *name, const char *desc, const char *default_val,
693693
validate_string_relopt validator)
694694
{
695695
relopt_string *newoption;
@@ -742,7 +742,7 @@ add_string_reloption(bits32 kinds, char *name, char *desc, char *default_val,
742742
* but we declare them as Datums to avoid including array.h in reloptions.h.
743743
*/
744744
Datum
745-
transformRelOptions(Datum oldOptions, List *defList, char *namspace,
745+
transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
746746
char *validnsps[], bool ignoreOids, bool isReset)
747747
{
748748
Datum result;

src/backend/access/gist/gistbuild.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo)
238238
* and "auto" values.
239239
*/
240240
void
241-
gistValidateBufferingOption(char *value)
241+
gistValidateBufferingOption(const char *value)
242242
{
243243
if (value == NULL ||
244244
(strcmp(value, "on") != 0 &&

src/backend/access/transam/xact.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3478,7 +3478,7 @@ BeginTransactionBlock(void)
34783478
* resource owner, etc while executing inside a Portal.
34793479
*/
34803480
bool
3481-
PrepareTransactionBlock(char *gid)
3481+
PrepareTransactionBlock(const char *gid)
34823482
{
34833483
TransactionState s;
34843484
bool result;
@@ -3823,7 +3823,7 @@ EndImplicitTransactionBlock(void)
38233823
* This executes a SAVEPOINT command.
38243824
*/
38253825
void
3826-
DefineSavepoint(char *name)
3826+
DefineSavepoint(const char *name)
38273827
{
38283828
TransactionState s = CurrentTransactionState;
38293829

@@ -4168,7 +4168,7 @@ RollbackToSavepoint(List *options)
41684168
* the caller to do it.
41694169
*/
41704170
void
4171-
BeginInternalSubTransaction(char *name)
4171+
BeginInternalSubTransaction(const char *name)
41724172
{
41734173
TransactionState s = CurrentTransactionState;
41744174

src/backend/access/transam/xlogarchive.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ RestoreArchivedFile(char *path, const char *xlogfname,
327327
* This is currently used for recovery_end_command and archive_cleanup_command.
328328
*/
329329
void
330-
ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
330+
ExecuteRecoveryCommand(const char *command, const char *commandName, bool failOnSignal)
331331
{
332332
char xlogRecoveryCmd[MAXPGPATH];
333333
char lastRestartPointFname[MAXPGPATH];
@@ -425,7 +425,7 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
425425
* in pg_wal (xlogfname), replacing any existing file with the same name.
426426
*/
427427
void
428-
KeepFileRestoredFromArchive(char *path, char *xlogfname)
428+
KeepFileRestoredFromArchive(const char *path, const char *xlogfname)
429429
{
430430
char xlogfpath[MAXPGPATH];
431431
bool reload = false;

src/backend/catalog/heap.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ static ObjectAddress AddNewRelationType(const char *typeName,
103103
Oid new_row_type,
104104
Oid new_array_type);
105105
static void RelationRemoveInheritance(Oid relid);
106-
static Oid StoreRelCheck(Relation rel, char *ccname, Node *expr,
106+
static Oid StoreRelCheck(Relation rel, const char *ccname, Node *expr,
107107
bool is_validated, bool is_local, int inhcount,
108108
bool is_no_inherit, bool is_internal);
109109
static void StoreConstraints(Relation rel, List *cooked_constraints,
110110
bool is_internal);
111-
static bool MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr,
111+
static bool MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr,
112112
bool allow_merge, bool is_local,
113113
bool is_initially_valid,
114114
bool is_no_inherit);
@@ -2037,7 +2037,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
20372037
* The OID of the new constraint is returned.
20382038
*/
20392039
static Oid
2040-
StoreRelCheck(Relation rel, char *ccname, Node *expr,
2040+
StoreRelCheck(Relation rel, const char *ccname, Node *expr,
20412041
bool is_validated, bool is_local, int inhcount,
20422042
bool is_no_inherit, bool is_internal)
20432043
{
@@ -2461,7 +2461,7 @@ AddRelationNewConstraints(Relation rel,
24612461
* XXX See MergeConstraintsIntoExisting too if you change this code.
24622462
*/
24632463
static bool
2464-
MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr,
2464+
MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr,
24652465
bool allow_merge, bool is_local,
24662466
bool is_initially_valid,
24672467
bool is_no_inherit)
@@ -2658,7 +2658,7 @@ cookDefault(ParseState *pstate,
26582658
Node *raw_default,
26592659
Oid atttypid,
26602660
int32 atttypmod,
2661-
char *attname)
2661+
const char *attname)
26622662
{
26632663
Node *expr;
26642664

src/backend/commands/comment.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ CommentObject(CommentStmt *stmt)
139139
* existing comment for the specified key.
140140
*/
141141
void
142-
CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
142+
CreateComments(Oid oid, Oid classoid, int32 subid, const char *comment)
143143
{
144144
Relation description;
145145
ScanKeyData skey[3];
@@ -234,7 +234,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
234234
* existing comment for the specified key.
235235
*/
236236
void
237-
CreateSharedComments(Oid oid, Oid classoid, char *comment)
237+
CreateSharedComments(Oid oid, Oid classoid, const char *comment)
238238
{
239239
Relation shdescription;
240240
ScanKeyData skey[2];

src/backend/commands/event_trigger.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static event_trigger_command_tag_check_result check_table_rewrite_ddl_tag(
152152
const char *tag);
153153
static void error_duplicate_filter_variable(const char *defname);
154154
static Datum filter_list_to_array(List *filterlist);
155-
static Oid insert_event_trigger_tuple(char *trigname, char *eventname,
155+
static Oid insert_event_trigger_tuple(const char *trigname, const char *eventname,
156156
Oid evtOwner, Oid funcoid, List *tags);
157157
static void validate_ddl_tags(const char *filtervar, List *taglist);
158158
static void validate_table_rewrite_tags(const char *filtervar, List *taglist);
@@ -372,7 +372,7 @@ error_duplicate_filter_variable(const char *defname)
372372
* Insert the new pg_event_trigger row and record dependencies.
373373
*/
374374
static Oid
375-
insert_event_trigger_tuple(char *trigname, char *eventname, Oid evtOwner,
375+
insert_event_trigger_tuple(const char *trigname, const char *eventname, Oid evtOwner,
376376
Oid funcoid, List *taglist)
377377
{
378378
Relation tgrel;

src/backend/commands/extension.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,8 @@ find_install_path(List *evi_list, ExtensionVersionInfo *evi_target,
12661266
static ObjectAddress
12671267
CreateExtensionInternal(char *extensionName,
12681268
char *schemaName,
1269-
char *versionName,
1270-
char *oldVersionName,
1269+
const char *versionName,
1270+
const char *oldVersionName,
12711271
bool cascade,
12721272
List *parents,
12731273
bool is_create)

src/backend/commands/indexcmds.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void ComputeIndexAttrs(IndexInfo *indexInfo,
6767
List *attList,
6868
List *exclusionOpNames,
6969
Oid relId,
70-
char *accessMethodName, Oid accessMethodId,
70+
const char *accessMethodName, Oid accessMethodId,
7171
bool amcanorder,
7272
bool isconstraint);
7373
static char *ChooseIndexName(const char *tabname, Oid namespaceId,
@@ -115,7 +115,7 @@ static void RangeVarCallbackForReindexIndex(const RangeVar *relation,
115115
*/
116116
bool
117117
CheckIndexCompatible(Oid oldId,
118-
char *accessMethodName,
118+
const char *accessMethodName,
119119
List *attributeList,
120120
List *exclusionOpNames)
121121
{
@@ -1011,7 +1011,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
10111011
List *attList, /* list of IndexElem's */
10121012
List *exclusionOpNames,
10131013
Oid relId,
1014-
char *accessMethodName,
1014+
const char *accessMethodName,
10151015
Oid accessMethodId,
10161016
bool amcanorder,
10171017
bool isconstraint)
@@ -1277,7 +1277,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
12771277
*/
12781278
Oid
12791279
ResolveOpClass(List *opclass, Oid attrType,
1280-
char *accessMethodName, Oid accessMethodId)
1280+
const char *accessMethodName, Oid accessMethodId)
12811281
{
12821282
char *schemaname;
12831283
char *opcname;

src/backend/commands/opclasscmds.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ get_opclass_oid(Oid amID, List *opclassname, bool missing_ok)
239239
* Caller must have done permissions checks etc. already.
240240
*/
241241
static ObjectAddress
242-
CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
242+
CreateOpFamily(const char *amname, const char *opfname, Oid namespaceoid, Oid amoid)
243243
{
244244
Oid opfamilyoid;
245245
Relation rel;

0 commit comments

Comments
 (0)