Add some const decorations to prototypes
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 31 Oct 2017 14:34:31 +0000 (10:34 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 10 Nov 2017 18:38:57 +0000 (13:38 -0500)
Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
95 files changed:
contrib/dict_xsyn/dict_xsyn.c
contrib/fuzzystrmatch/dmetaphone.c
contrib/pgcrypto/pgcrypto.c
contrib/seg/seg.c
contrib/seg/segdata.h
contrib/seg/segparse.y
contrib/unaccent/unaccent.c
contrib/uuid-ossp/uuid-ossp.c
src/backend/access/common/reloptions.c
src/backend/access/gist/gistbuild.c
src/backend/access/transam/xact.c
src/backend/access/transam/xlogarchive.c
src/backend/catalog/heap.c
src/backend/commands/comment.c
src/backend/commands/event_trigger.c
src/backend/commands/extension.c
src/backend/commands/indexcmds.c
src/backend/commands/opclasscmds.c
src/backend/commands/tablecmds.c
src/backend/commands/typecmds.c
src/backend/commands/view.c
src/backend/libpq/auth.c
src/backend/libpq/hba.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_target.c
src/backend/port/dynloader/darwin.c
src/backend/port/dynloader/darwin.h
src/backend/port/dynloader/hpux.c
src/backend/port/dynloader/hpux.h
src/backend/port/dynloader/linux.c
src/backend/postmaster/postmaster.c
src/backend/replication/basebackup.c
src/backend/rewrite/rewriteDefine.c
src/backend/snowball/dict_snowball.c
src/backend/storage/lmgr/lwlock.c
src/backend/tsearch/dict_thesaurus.c
src/backend/tsearch/spell.c
src/backend/utils/adt/genfile.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/varlena.c
src/backend/utils/adt/xml.c
src/bin/initdb/initdb.c
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_backup_db.h
src/bin/pg_rewind/fetch.c
src/bin/pg_rewind/fetch.h
src/bin/pg_upgrade/option.c
src/bin/pg_upgrade/pg_upgrade.c
src/bin/pg_waldump/pg_waldump.c
src/bin/pgbench/pgbench.c
src/include/access/gist_private.h
src/include/access/reloptions.h
src/include/access/xact.h
src/include/access/xlog_internal.h
src/include/catalog/heap.h
src/include/commands/comment.h
src/include/commands/defrem.h
src/include/commands/typecmds.h
src/include/commands/view.h
src/include/executor/tablefunc.h
src/include/parser/parse_relation.h
src/include/parser/parse_target.h
src/include/postmaster/bgworker.h
src/include/rewrite/rewriteDefine.h
src/include/storage/lwlock.h
src/include/utils/dynamic_loader.h
src/include/utils/varlena.h
src/include/utils/xml.h
src/interfaces/ecpg/compatlib/informix.c
src/interfaces/ecpg/ecpglib/misc.c
src/interfaces/ecpg/include/ecpg_informix.h
src/interfaces/ecpg/include/ecpglib.h
src/interfaces/ecpg/include/pgtypes_date.h
src/interfaces/ecpg/include/pgtypes_timestamp.h
src/interfaces/ecpg/pgtypeslib/datetime.c
src/interfaces/ecpg/pgtypeslib/interval.c
src/interfaces/ecpg/pgtypeslib/timestamp.c
src/interfaces/ecpg/preproc/type.c
src/interfaces/ecpg/preproc/type.h
src/interfaces/ecpg/test/compat_informix/rfmtdate.pgc
src/interfaces/ecpg/test/compat_informix/rfmtlong.pgc
src/interfaces/ecpg/test/compat_informix/test_informix2.pgc
src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
src/interfaces/ecpg/test/expected/preproc-init.c
src/interfaces/ecpg/test/expected/preproc-whenever.c
src/interfaces/ecpg/test/preproc/init.pgc
src/interfaces/ecpg/test/preproc/whenever.pgc
src/interfaces/libpq/fe-connect.c
src/pl/plperl/plperl.c
src/test/regress/pg_regress.c
src/test/regress/pg_regress.h

index fcf541ee0f428a9b59b3dcee76752a39b4f4a452..977162951aae03eb84f4f3c36387c6afd180de71 100644 (file)
@@ -70,7 +70,7 @@ compare_syn(const void *a, const void *b)
 }
 
 static void
-read_dictionary(DictSyn *d, char *filename)
+read_dictionary(DictSyn *d, const char *filename)
 {
    char       *real_filename = get_tsearch_config_filename(filename, "rules");
    tsearch_readline_state trst;
index 918ee0d90e52ce3430e7cdf8432d1ed6caa816cb..16e4c66167bc935068aa335681ad59830b157e09 100644 (file)
@@ -232,7 +232,7 @@ metastring;
  */
 
 static metastring *
-NewMetaString(char *init_str)
+NewMetaString(const char *init_str)
 {
    metastring *s;
    char        empty_string[] = "";
@@ -375,7 +375,7 @@ StringAt(metastring *s, int start, int length,...)
 
 
 static void
-MetaphAdd(metastring *s, char *new_str)
+MetaphAdd(metastring *s, const char *new_str)
 {
    int         add_length;
 
index e09f3378da633a89ab39692c3c9c61bf60b99591..de09ececcfdacf423448f19da26db33e120b5995 100644 (file)
@@ -47,7 +47,7 @@ PG_MODULE_MAGIC;
 /* private stuff */
 
 typedef int (*PFN) (const char *name, void **res);
-static void *find_provider(text *name, PFN pf, char *desc, int silent);
+static void *find_provider(text *name, PFN pf, const char *desc, int silent);
 
 /* SQL function: hash(bytea, text) returns bytea */
 PG_FUNCTION_INFO_V1(pg_digest);
@@ -474,7 +474,7 @@ pg_random_uuid(PG_FUNCTION_ARGS)
 static void *
 find_provider(text *name,
              PFN provider_lookup,
-             char *desc, int silent)
+             const char *desc, int silent)
 {
    void       *res;
    char       *buf;
index 8bac4d50d038a3231e029b8c8058fabfbfd2267f..4e34fba7c7bc5d3db594ce3492b83c55149dce26 100644 (file)
@@ -1052,9 +1052,9 @@ restore(char *result, float val, int n)
  * a floating point number
  */
 int
-significant_digits(char *s)
+significant_digits(const char *s)
 {
-   char       *p = s;
+   const char *p = s;
    int         n,
                c,
                zeroes;
index cac68ee2b2ed15b1a063b74c22a8d118279d7e58..9488bf3a81a9474d0cd4c9c8bf5df08c8aaa8e3e 100644 (file)
@@ -12,7 +12,7 @@ typedef struct SEG
 } SEG;
 
 /* in seg.c */
-extern int significant_digits(char *str);
+extern int significant_digits(const char *str);
 
 /* in segscan.l */
 extern int seg_yylex(void);
index 045ff91f3e7dd2365f4963130108922ccd890308..040cab390418faffa1188cf2e8ad7e166e5ee25f 100644 (file)
@@ -21,7 +21,7 @@
 #define YYMALLOC palloc
 #define YYFREE   pfree
 
-static float seg_atof(char *value);
+static float seg_atof(const char *value);
 
 static char strbuf[25] = {
    '0', '0', '0', '0', '0',
@@ -151,7 +151,7 @@ deviation: SEGFLOAT
 
 
 static float
-seg_atof(char *value)
+seg_atof(const char *value)
 {
    Datum datum;
 
index e08cca1707f71780f443edf8ab647ec24302d2a2..e68b098b7825869dfba7ed45fc815fffe2bbb07f 100644 (file)
@@ -90,7 +90,7 @@ placeChar(TrieChar *node, const unsigned char *str, int lenstr,
  * Function converts UTF8-encoded file into current encoding.
  */
 static TrieChar *
-initTrie(char *filename)
+initTrie(const char *filename)
 {
    TrieChar   *volatile rootTrie = NULL;
    MemoryContext ccxt = CurrentMemoryContext;
index fce4bc9140bdb19bc9a2a8b1e46de84d63c41050..151223a1996acc6e778b73bd0109b48a488f55ec 100644 (file)
@@ -253,7 +253,7 @@ uuid_generate_v35_internal(int mode, pg_uuid_t *ns, text *name)
 #else                          /* !HAVE_UUID_OSSP */
 
 static Datum
-uuid_generate_internal(int v, unsigned char *ns, char *ptr, int len)
+uuid_generate_internal(int v, unsigned char *ns, const char *ptr, int len)
 {
    char        strbuf[40];
 
index ec10762529d7823e66d0d03573254ed23823a657..3d0ce9af6f618dce97bdada08225f95a20d065bf 100644 (file)
@@ -582,7 +582,7 @@ add_reloption(relopt_gen *newoption)
  *     (for types other than string)
  */
 static relopt_gen *
-allocate_reloption(bits32 kinds, int type, char *name, char *desc)
+allocate_reloption(bits32 kinds, int type, const char *name, const char *desc)
 {
    MemoryContext oldcxt;
    size_t      size;
@@ -630,7 +630,7 @@ allocate_reloption(bits32 kinds, int type, char *name, char *desc)
  *     Add a new boolean reloption
  */
 void
-add_bool_reloption(bits32 kinds, char *name, char *desc, bool default_val)
+add_bool_reloption(bits32 kinds, const char *name, const char *desc, bool default_val)
 {
    relopt_bool *newoption;
 
@@ -646,7 +646,7 @@ add_bool_reloption(bits32 kinds, char *name, char *desc, bool default_val)
  *     Add a new integer reloption
  */
 void
-add_int_reloption(bits32 kinds, char *name, char *desc, int default_val,
+add_int_reloption(bits32 kinds, const char *name, const char *desc, int default_val,
                  int min_val, int max_val)
 {
    relopt_int *newoption;
@@ -665,7 +665,7 @@ add_int_reloption(bits32 kinds, char *name, char *desc, int default_val,
  *     Add a new float reloption
  */
 void
-add_real_reloption(bits32 kinds, char *name, char *desc, double default_val,
+add_real_reloption(bits32 kinds, const char *name, const char *desc, double default_val,
                   double min_val, double max_val)
 {
    relopt_real *newoption;
@@ -689,7 +689,7 @@ add_real_reloption(bits32 kinds, char *name, char *desc, double default_val,
  * the validation.
  */
 void
-add_string_reloption(bits32 kinds, char *name, char *desc, char *default_val,
+add_string_reloption(bits32 kinds, const char *name, const char *desc, const char *default_val,
                     validate_string_relopt validator)
 {
    relopt_string *newoption;
@@ -742,7 +742,7 @@ add_string_reloption(bits32 kinds, char *name, char *desc, char *default_val,
  * but we declare them as Datums to avoid including array.h in reloptions.h.
  */
 Datum
-transformRelOptions(Datum oldOptions, List *defList, char *namspace,
+transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
                    char *validnsps[], bool ignoreOids, bool isReset)
 {
    Datum       result;
index b4cb36486908b9d247a2e742419cf8e0c5404f7b..2415f00e06201701198a576fefea06d0907db915 100644 (file)
@@ -238,7 +238,7 @@ gistbuild(Relation heap, Relation index, IndexInfo *indexInfo)
  * and "auto" values.
  */
 void
-gistValidateBufferingOption(char *value)
+gistValidateBufferingOption(const char *value)
 {
    if (value == NULL ||
        (strcmp(value, "on") != 0 &&
index 02a60f66b849dacc84552d5f4bbbe0e9824dea5c..c06fabca109828e53d4d080a2abbe8b06ce55473 100644 (file)
@@ -3478,7 +3478,7 @@ BeginTransactionBlock(void)
  * resource owner, etc while executing inside a Portal.
  */
 bool
-PrepareTransactionBlock(char *gid)
+PrepareTransactionBlock(const char *gid)
 {
    TransactionState s;
    bool        result;
@@ -3823,7 +3823,7 @@ EndImplicitTransactionBlock(void)
  *     This executes a SAVEPOINT command.
  */
 void
-DefineSavepoint(char *name)
+DefineSavepoint(const char *name)
 {
    TransactionState s = CurrentTransactionState;
 
@@ -4168,7 +4168,7 @@ RollbackToSavepoint(List *options)
  *     the caller to do it.
  */
 void
-BeginInternalSubTransaction(char *name)
+BeginInternalSubTransaction(const char *name)
 {
    TransactionState s = CurrentTransactionState;
 
index f64f04cfaf53b133efa7668f9d39e3c937ae7824..488acd0f707d29c06ef6331cfb6f69e1e5a3e3d7 100644 (file)
@@ -327,7 +327,7 @@ not_available:
  * This is currently used for recovery_end_command and archive_cleanup_command.
  */
 void
-ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
+ExecuteRecoveryCommand(const char *command, const char *commandName, bool failOnSignal)
 {
    char        xlogRecoveryCmd[MAXPGPATH];
    char        lastRestartPointFname[MAXPGPATH];
@@ -425,7 +425,7 @@ ExecuteRecoveryCommand(char *command, char *commandName, bool failOnSignal)
  * in pg_wal (xlogfname), replacing any existing file with the same name.
  */
 void
-KeepFileRestoredFromArchive(char *path, char *xlogfname)
+KeepFileRestoredFromArchive(const char *path, const char *xlogfname)
 {
    char        xlogfpath[MAXPGPATH];
    bool        reload = false;
index 2bc9e90dcfae72ee903c091a79c89ad636be5f4d..9e14880b998d7510a3db4f4150f6ba4e03789a92 100644 (file)
@@ -103,12 +103,12 @@ static ObjectAddress AddNewRelationType(const char *typeName,
                   Oid new_row_type,
                   Oid new_array_type);
 static void RelationRemoveInheritance(Oid relid);
-static Oid StoreRelCheck(Relation rel, char *ccname, Node *expr,
+static Oid StoreRelCheck(Relation rel, const char *ccname, Node *expr,
              bool is_validated, bool is_local, int inhcount,
              bool is_no_inherit, bool is_internal);
 static void StoreConstraints(Relation rel, List *cooked_constraints,
                 bool is_internal);
-static bool MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr,
+static bool MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr,
                            bool allow_merge, bool is_local,
                            bool is_initially_valid,
                            bool is_no_inherit);
@@ -2037,7 +2037,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
  * The OID of the new constraint is returned.
  */
 static Oid
-StoreRelCheck(Relation rel, char *ccname, Node *expr,
+StoreRelCheck(Relation rel, const char *ccname, Node *expr,
              bool is_validated, bool is_local, int inhcount,
              bool is_no_inherit, bool is_internal)
 {
@@ -2461,7 +2461,7 @@ AddRelationNewConstraints(Relation rel,
  * XXX See MergeConstraintsIntoExisting too if you change this code.
  */
 static bool
-MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr,
+MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr,
                            bool allow_merge, bool is_local,
                            bool is_initially_valid,
                            bool is_no_inherit)
@@ -2658,7 +2658,7 @@ cookDefault(ParseState *pstate,
            Node *raw_default,
            Oid atttypid,
            int32 atttypmod,
-           char *attname)
+           const char *attname)
 {
    Node       *expr;
 
index 1c17927c499d7d4a706f4578d9eb1b605b85066d..2dc9371fdbc6306989c8be6637b591cd8136aa0f 100644 (file)
@@ -139,7 +139,7 @@ CommentObject(CommentStmt *stmt)
  * existing comment for the specified key.
  */
 void
-CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
+CreateComments(Oid oid, Oid classoid, int32 subid, const char *comment)
 {
    Relation    description;
    ScanKeyData skey[3];
@@ -234,7 +234,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
  * existing comment for the specified key.
  */
 void
-CreateSharedComments(Oid oid, Oid classoid, char *comment)
+CreateSharedComments(Oid oid, Oid classoid, const char *comment)
 {
    Relation    shdescription;
    ScanKeyData skey[2];
index 938133bbe43e0c2bf8d6265f7a3ab5833a6bbbc2..fa7d0d015aa8dda1e2b861758b788462217ca5d8 100644 (file)
@@ -152,7 +152,7 @@ static event_trigger_command_tag_check_result check_table_rewrite_ddl_tag(
                            const char *tag);
 static void error_duplicate_filter_variable(const char *defname);
 static Datum filter_list_to_array(List *filterlist);
-static Oid insert_event_trigger_tuple(char *trigname, char *eventname,
+static Oid insert_event_trigger_tuple(const char *trigname, const char *eventname,
                           Oid evtOwner, Oid funcoid, List *tags);
 static void validate_ddl_tags(const char *filtervar, List *taglist);
 static void validate_table_rewrite_tags(const char *filtervar, List *taglist);
@@ -372,7 +372,7 @@ error_duplicate_filter_variable(const char *defname)
  * Insert the new pg_event_trigger row and record dependencies.
  */
 static Oid
-insert_event_trigger_tuple(char *trigname, char *eventname, Oid evtOwner,
+insert_event_trigger_tuple(const char *trigname, const char *eventname, Oid evtOwner,
                           Oid funcoid, List *taglist)
 {
    Relation    tgrel;
index e4340eed8c4b9b8180deb83741224dd15552a6e3..9f77d2535276cd7f5258851eebec735840fb61b3 100644 (file)
@@ -1266,8 +1266,8 @@ find_install_path(List *evi_list, ExtensionVersionInfo *evi_target,
 static ObjectAddress
 CreateExtensionInternal(char *extensionName,
                        char *schemaName,
-                       char *versionName,
-                       char *oldVersionName,
+                       const char *versionName,
+                       const char *oldVersionName,
                        bool cascade,
                        List *parents,
                        bool is_create)
index 3f615b62606ba222d036914cc71b444da0344061..89114af119e377f5e7cf3ad52cb0b65598b25965 100644 (file)
@@ -67,7 +67,7 @@ static void ComputeIndexAttrs(IndexInfo *indexInfo,
                  List *attList,
                  List *exclusionOpNames,
                  Oid relId,
-                 char *accessMethodName, Oid accessMethodId,
+                 const char *accessMethodName, Oid accessMethodId,
                  bool amcanorder,
                  bool isconstraint);
 static char *ChooseIndexName(const char *tabname, Oid namespaceId,
@@ -115,7 +115,7 @@ static void RangeVarCallbackForReindexIndex(const RangeVar *relation,
  */
 bool
 CheckIndexCompatible(Oid oldId,
-                    char *accessMethodName,
+                    const char *accessMethodName,
                     List *attributeList,
                     List *exclusionOpNames)
 {
@@ -1011,7 +1011,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
                  List *attList,    /* list of IndexElem's */
                  List *exclusionOpNames,
                  Oid relId,
-                 char *accessMethodName,
+                 const char *accessMethodName,
                  Oid accessMethodId,
                  bool amcanorder,
                  bool isconstraint)
@@ -1277,7 +1277,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
  */
 Oid
 ResolveOpClass(List *opclass, Oid attrType,
-              char *accessMethodName, Oid accessMethodId)
+              const char *accessMethodName, Oid accessMethodId)
 {
    char       *schemaname;
    char       *opcname;
index d23e6d6f250d12b6017257f44bfb2faddd3325e8..1641e68abec05097d71f860776532ba5745d42fc 100644 (file)
@@ -239,7 +239,7 @@ get_opclass_oid(Oid amID, List *opclassname, bool missing_ok)
  * Caller must have done permissions checks etc. already.
  */
 static ObjectAddress
-CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
+CreateOpFamily(const char *amname, const char *opfname, Oid namespaceoid, Oid amoid)
 {
    Oid         opfamilyoid;
    Relation    rel;
index 165b165d5582c4b37a8caecade635c43d75fe9f1..9c66aa75ed32323eaa6f09eec6b436e0ea0fc47e 100644 (file)
@@ -426,7 +426,7 @@ static void ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid refRelId,
                     bool rewrite);
 static void RebuildConstraintComment(AlteredTableInfo *tab, int pass,
                         Oid objid, Relation rel, List *domname,
-                        char *conname);
+                        const char *conname);
 static void TryReuseIndex(Oid oldId, IndexStmt *stmt);
 static void TryReuseForeignKey(Oid oldId, Constraint *con);
 static void change_owner_fix_column_acls(Oid relationOid,
@@ -438,14 +438,14 @@ static ObjectAddress ATExecClusterOn(Relation rel, const char *indexName,
 static void ATExecDropCluster(Relation rel, LOCKMODE lockmode);
 static bool ATPrepChangePersistence(Relation rel, bool toLogged);
 static void ATPrepSetTableSpace(AlteredTableInfo *tab, Relation rel,
-                   char *tablespacename, LOCKMODE lockmode);
+                   const char *tablespacename, LOCKMODE lockmode);
 static void ATExecSetTableSpace(Oid tableOid, Oid newTableSpace, LOCKMODE lockmode);
 static void ATExecSetRelOptions(Relation rel, List *defList,
                    AlterTableType operation,
                    LOCKMODE lockmode);
-static void ATExecEnableDisableTrigger(Relation rel, char *trigname,
+static void ATExecEnableDisableTrigger(Relation rel, const char *trigname,
                           char fires_when, bool skip_system, LOCKMODE lockmode);
-static void ATExecEnableDisableRule(Relation rel, char *rulename,
+static void ATExecEnableDisableRule(Relation rel, const char *rulename,
                        char fires_when, LOCKMODE lockmode);
 static void ATPrepAddInherit(Relation child_rel);
 static ObjectAddress ATExecAddInherit(Relation child_rel, RangeVar *parent, LOCKMODE lockmode);
@@ -9873,7 +9873,7 @@ ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid refRelId, char *cmd,
 static void
 RebuildConstraintComment(AlteredTableInfo *tab, int pass, Oid objid,
                         Relation rel, List *domname,
-                        char *conname)
+                        const char *conname)
 {
    CommentStmt *cmd;
    char       *comment_str;
@@ -10393,7 +10393,7 @@ ATExecDropCluster(Relation rel, LOCKMODE lockmode)
  * ALTER TABLE SET TABLESPACE
  */
 static void
-ATPrepSetTableSpace(AlteredTableInfo *tab, Relation rel, char *tablespacename, LOCKMODE lockmode)
+ATPrepSetTableSpace(AlteredTableInfo *tab, Relation rel, const char *tablespacename, LOCKMODE lockmode)
 {
    Oid         tablespaceId;
 
@@ -11060,7 +11060,7 @@ copy_relation_data(SMgrRelation src, SMgrRelation dst,
  * We just pass this off to trigger.c.
  */
 static void
-ATExecEnableDisableTrigger(Relation rel, char *trigname,
+ATExecEnableDisableTrigger(Relation rel, const char *trigname,
                           char fires_when, bool skip_system, LOCKMODE lockmode)
 {
    EnableDisableTrigger(rel, trigname, fires_when, skip_system);
@@ -11072,7 +11072,7 @@ ATExecEnableDisableTrigger(Relation rel, char *trigname,
  * We just pass this off to rewriteDefine.c.
  */
 static void
-ATExecEnableDisableRule(Relation rel, char *rulename,
+ATExecEnableDisableRule(Relation rel, const char *rulename,
                        char fires_when, LOCKMODE lockmode)
 {
    EnableDisableRule(rel, rulename, fires_when);
index 08f3a3d357a9487cebb7b8072f8a315c5c195525..f86af4c054ed20ba3d67f655f382f910a7f2249b 100644 (file)
@@ -103,7 +103,7 @@ static void checkEnumOwner(HeapTuple tup);
 static char *domainAddConstraint(Oid domainOid, Oid domainNamespace,
                    Oid baseTypeOid,
                    int typMod, Constraint *constr,
-                   char *domainName, ObjectAddress *constrAddr);
+                   const char *domainName, ObjectAddress *constrAddr);
 static Node *replace_domain_constraint_value(ParseState *pstate,
                                ColumnRef *cref);
 
@@ -2649,7 +2649,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint,
  * Implements the ALTER DOMAIN .. VALIDATE CONSTRAINT statement.
  */
 ObjectAddress
-AlterDomainValidateConstraint(List *names, char *constrName)
+AlterDomainValidateConstraint(List *names, const char *constrName)
 {
    TypeName   *typename;
    Oid         domainoid;
@@ -3060,7 +3060,7 @@ checkDomainOwner(HeapTuple tup)
 static char *
 domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
                    int typMod, Constraint *constr,
-                   char *domainName, ObjectAddress *constrAddr)
+                   const char *domainName, ObjectAddress *constrAddr)
 {
    Node       *expr;
    char       *ccsrc;
index 076e2a3a40212e5db9fd22474a65d104a0bcc369..c1e80e61d405a73ed307f1586a37e4417c69cca7 100644 (file)
@@ -43,7 +43,7 @@ static void checkViewTupleDesc(TupleDesc newdesc, TupleDesc olddesc);
  * are "local" and "cascaded".
  */
 void
-validateWithCheckOption(char *value)
+validateWithCheckOption(const char *value)
 {
    if (value == NULL ||
        (pg_strcasecmp(value, "local") != 0 &&
index ab74fd8dfd8531fce5eacdd7f801430d1702461d..6505b1f2b9befc58e09df201cf9743ced7c03be9 100644 (file)
@@ -43,7 +43,7 @@
  * Global authentication functions
  *----------------------------------------------------------------
  */
-static void sendAuthRequest(Port *port, AuthRequest areq, char *extradata,
+static void sendAuthRequest(Port *port, AuthRequest areq, const char *extradata,
                int extralen);
 static void auth_failed(Port *port, int status, char *logdetail);
 static char *recv_password_packet(Port *port);
@@ -91,7 +91,7 @@ static int    auth_peer(hbaPort *port);
 
 #define PGSQL_PAM_SERVICE "postgresql" /* Service name passed to PAM */
 
-static int CheckPAMAuth(Port *port, char *user, char *password);
+static int CheckPAMAuth(Port *port, const char *user, const char *password);
 static int pam_passwd_conv_proc(int num_msg, const struct pam_message **msg,
                     struct pam_response **resp, void *appdata_ptr);
 
@@ -100,7 +100,7 @@ static struct pam_conv pam_passw_conv = {
    NULL
 };
 
-static char *pam_passwd = NULL; /* Workaround for Solaris 2.6 brokenness */
+static const char *pam_passwd = NULL; /* Workaround for Solaris 2.6 brokenness */
 static Port *pam_port_cludge;  /* Workaround for passing "Port *port" into
                                 * pam_passwd_conv_proc */
 #endif                         /* USE_PAM */
@@ -202,7 +202,7 @@ static int pg_SSPI_make_upn(char *accountname,
  *----------------------------------------------------------------
  */
 static int CheckRADIUSAuth(Port *port);
-static int PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identifier, char *user_name, char *passwd);
+static int PerformRadiusTransaction(const char *server, const char *secret, const char *portstr, const char *identifier, const char *user_name, const char *passwd);
 
 
 /*
@@ -612,7 +612,7 @@ ClientAuthentication(Port *port)
  * Send an authentication request packet to the frontend.
  */
 static void
-sendAuthRequest(Port *port, AuthRequest areq, char *extradata, int extralen)
+sendAuthRequest(Port *port, AuthRequest areq, const char *extradata, int extralen)
 {
    StringInfoData buf;
 
@@ -1040,7 +1040,7 @@ static GSS_DLLIMP gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_desc;
 
 
 static void
-pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
+pg_GSS_error(int severity, const char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
 {
    gss_buffer_desc gmsg;
    OM_uint32   lmin_s,
@@ -2051,7 +2051,7 @@ static int
 pam_passwd_conv_proc(int num_msg, const struct pam_message **msg,
                     struct pam_response **resp, void *appdata_ptr)
 {
-   char       *passwd;
+   const char *passwd;
    struct pam_response *reply;
    int         i;
 
@@ -2149,7 +2149,7 @@ fail:
  * Check authentication against PAM.
  */
 static int
-CheckPAMAuth(Port *port, char *user, char *password)
+CheckPAMAuth(Port *port, const char *user, const char *password)
 {
    int         retval;
    pam_handle_t *pamh = NULL;
@@ -2874,7 +2874,7 @@ CheckRADIUSAuth(Port *port)
 }
 
 static int
-PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identifier, char *user_name, char *passwd)
+PerformRadiusTransaction(const char *server, const char *secret, const char *portstr, const char *identifier, const char *user_name, const char *passwd)
 {
    radius_packet radius_send_pack;
    radius_packet radius_recv_pack;
@@ -2941,9 +2941,9 @@ PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identi
        return STATUS_ERROR;
    }
    packet->id = packet->vector[0];
-   radius_add_attribute(packet, RADIUS_SERVICE_TYPE, (unsigned char *) &service, sizeof(service));
-   radius_add_attribute(packet, RADIUS_USER_NAME, (unsigned char *) user_name, strlen(user_name));
-   radius_add_attribute(packet, RADIUS_NAS_IDENTIFIER, (unsigned char *) identifier, strlen(identifier));
+   radius_add_attribute(packet, RADIUS_SERVICE_TYPE, (const unsigned char *) &service, sizeof(service));
+   radius_add_attribute(packet, RADIUS_USER_NAME, (const unsigned char *) user_name, strlen(user_name));
+   radius_add_attribute(packet, RADIUS_NAS_IDENTIFIER, (const unsigned char *) identifier, strlen(identifier));
 
    /*
     * RADIUS password attributes are calculated as: e[0] = p[0] XOR
index 210f13cc8748702d166444fcec9d31bef7f59739..1e97c9db10c54d8e24f458423f530976b62d1977 100644 (file)
@@ -144,8 +144,8 @@ static List *tokenize_inc_file(List *tokens, const char *outer_filename,
                  const char *inc_filename, int elevel, char **err_msg);
 static bool parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline,
                   int elevel, char **err_msg);
-static bool verify_option_list_length(List *options, char *optionname,
-                         List *masters, char *mastername, int line_num);
+static bool verify_option_list_length(List *options, const char *optionname,
+                         List *masters, const char *mastername, int line_num);
 static ArrayType *gethba_options(HbaLine *hba);
 static void fill_hba_line(Tuplestorestate *tuple_store, TupleDesc tupdesc,
              int lineno, HbaLine *hba, const char *err_msg);
@@ -1617,7 +1617,7 @@ parse_hba_line(TokenizedLine *tok_line, int elevel)
 
 
 static bool
-verify_option_list_length(List *options, char *optionname, List *masters, char *mastername, int line_num)
+verify_option_list_length(List *options, const char *optionname, List *masters, const char *mastername, int line_num)
 {
    if (list_length(options) == 0 ||
        list_length(options) == 1 ||
index 1aaa5244e654ebc1b5eb9521b31b5d179ff9c97d..86d1da067755987327894f674fce2c66487f459e 100644 (file)
@@ -386,7 +386,7 @@ transformExprRecurse(ParseState *pstate, Node *expr)
  * selection from an arbitrary node needs it.)
  */
 static void
-unknown_attribute(ParseState *pstate, Node *relref, char *attname,
+unknown_attribute(ParseState *pstate, Node *relref, const char *attname,
                  int location)
 {
    RangeTblEntry *rte;
index fc0d6bc2f2eeea5aa97a188ec2bf3e6c062d8361..a11843332b0847823c71eb6bf4bbf1dad0c7d8a7 100644 (file)
@@ -39,7 +39,7 @@ static void unify_hypothetical_args(ParseState *pstate,
                        List *fargs, int numAggregatedArgs,
                        Oid *actual_arg_types, Oid *declared_arg_types);
 static Oid FuncNameAsType(List *funcname);
-static Node *ParseComplexProjection(ParseState *pstate, char *funcname,
+static Node *ParseComplexProjection(ParseState *pstate, const char *funcname,
                       Node *first_arg, int location);
 
 
@@ -1790,7 +1790,7 @@ FuncNameAsType(List *funcname)
  *   transformed expression tree.  If not, return NULL.
  */
 static Node *
-ParseComplexProjection(ParseState *pstate, char *funcname, Node *first_arg,
+ParseComplexProjection(ParseState *pstate, const char *funcname, Node *first_arg,
                       int location)
 {
    TupleDesc   tupdesc;
index e6740c291dab886943c7f7ad67bd48836a2df14f..58bdb23c4e8ab71e7abb8f0828d308177914cae6 100644 (file)
@@ -652,7 +652,7 @@ updateFuzzyAttrMatchState(int fuzzy_rte_penalty,
  * for an approximate match and update fuzzystate accordingly.
  */
 Node *
-scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, char *colname,
+scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, const char *colname,
                 int location, int fuzzy_rte_penalty,
                 FuzzyAttrMatchState *fuzzystate)
 {
@@ -754,7 +754,7 @@ scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, char *colname,
  *   If localonly is true, only names in the innermost query are considered.
  */
 Node *
-colNameToVar(ParseState *pstate, char *colname, bool localonly,
+colNameToVar(ParseState *pstate, const char *colname, bool localonly,
             int location)
 {
    Node       *result = NULL;
@@ -828,7 +828,7 @@ colNameToVar(ParseState *pstate, char *colname, bool localonly,
  * and 'second' will contain the attribute number for the second match.
  */
 static FuzzyAttrMatchState *
-searchRangeTableForCol(ParseState *pstate, const char *alias, char *colname,
+searchRangeTableForCol(ParseState *pstate, const char *alias, const char *colname,
                       int location)
 {
    ParseState *orig_pstate = pstate;
@@ -3248,7 +3248,7 @@ errorMissingRTE(ParseState *pstate, RangeVar *relation)
  */
 void
 errorMissingColumn(ParseState *pstate,
-                  char *relname, char *colname, int location)
+                  const char *relname, const char *colname, int location)
 {
    FuzzyAttrMatchState *state;
    char       *closestfirst = NULL;
index 01fd726a3d8a52a8fd1ab03002ef59cb0b2e569b..21593b249f8343570e883fc62626713a6b39f273 100644 (file)
@@ -455,7 +455,7 @@ Expr *
 transformAssignedExpr(ParseState *pstate,
                      Expr *expr,
                      ParseExprKind exprKind,
-                     char *colname,
+                     const char *colname,
                      int attrno,
                      List *indirection,
                      int location)
index 18092cc759b06e000caeeab475903bb1654e9d95..93f19878f56a25d56dbf7fab51c01ce5490ec586 100644 (file)
@@ -20,7 +20,7 @@
 #ifdef HAVE_DLOPEN
 
 void *
-pg_dlopen(char *filename)
+pg_dlopen(const char *filename)
 {
    return dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
 }
@@ -32,7 +32,7 @@ pg_dlclose(void *handle)
 }
 
 PGFunction
-pg_dlsym(void *handle, char *funcname)
+pg_dlsym(void *handle, const char *funcname)
 {
    /* Do not prepend an underscore: see dlopen(3) */
    return dlsym(handle, funcname);
@@ -54,7 +54,7 @@ pg_dlerror(void)
 static NSObjectFileImageReturnCode cofiff_result = NSObjectFileImageFailure;
 
 void *
-pg_dlopen(char *filename)
+pg_dlopen(const char *filename)
 {
    NSObjectFileImage image;
 
@@ -73,7 +73,7 @@ pg_dlclose(void *handle)
 }
 
 PGFunction
-pg_dlsym(void *handle, char *funcname)
+pg_dlsym(void *handle, const char *funcname)
 {
    NSSymbol symbol;
    char       *symname = (char *) malloc(strlen(funcname) + 2);
index 44a3bd6b82943cb29e98f9676378e777ca5d4e74..292a31de13102b8793e0dde3d0eea65468e7cbd0 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "fmgr.h"
 
-void      *pg_dlopen(char *filename);
-PGFunction pg_dlsym(void *handle, char *funcname);
+void      *pg_dlopen(const char *filename);
+PGFunction pg_dlsym(void *handle, const char *funcname);
 void       pg_dlclose(void *handle);
 char      *pg_dlerror(void);
index 5a0e40146d8e20c7f034251515fe8e2dde62e3fb..5ab24f8fd9f56faf407d34961f971500f8f8512e 100644 (file)
@@ -26,7 +26,7 @@
 #include "utils/dynamic_loader.h"
 
 void *
-pg_dlopen(char *filename)
+pg_dlopen(const char *filename)
 {
    /*
     * Use BIND_IMMEDIATE so that undefined symbols cause a failure return
@@ -41,7 +41,7 @@ pg_dlopen(char *filename)
 }
 
 PGFunction
-pg_dlsym(void *handle, char *funcname)
+pg_dlsym(void *handle, const char *funcname)
 {
    PGFunction  f;
 
index 0a17454f2b894fe6f561813235a7af74808f78b3..6c1b367e97a0c2a3db38088f7a49c8ff7f0543c8 100644 (file)
@@ -19,7 +19,7 @@
 /* System includes */
 #include "fmgr.h"
 
-extern void *pg_dlopen(char *filename);
-extern PGFunction pg_dlsym(void *handle, char *funcname);
+extern void *pg_dlopen(const char *filename);
+extern PGFunction pg_dlsym(void *handle, const char *funcname);
 extern void pg_dlclose(void *handle);
 extern char *pg_dlerror(void);
index 38e19f74840d90ddbbe5931c35c469fc8c42b845..375ade32e5196277db0057cdcc2dc0088f2d6fab 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef HAVE_DLOPEN
 
 void *
-pg_dlopen(char *filename)
+pg_dlopen(const char *filename)
 {
 #ifndef HAVE_DLD_H
    elog(ERROR, "dynamic load not supported");
@@ -101,7 +101,7 @@ pg_dlopen(char *filename)
 }
 
 PGFunction
-pg_dlsym(void *handle, char *funcname)
+pg_dlsym(void *handle, const char *funcname)
 {
 #ifndef HAVE_DLD_H
    return NULL;
index 2b2b993e2cfc828191949ed50dffcc793acf2492..9906a85bc0effec6bceb95a8d9bca8461b886894 100644 (file)
@@ -5537,7 +5537,7 @@ MaxLivePostmasterChildren(void)
  * Connect background worker to a database.
  */
 void
-BackgroundWorkerInitializeConnection(char *dbname, char *username)
+BackgroundWorkerInitializeConnection(const char *dbname, const char *username)
 {
    BackgroundWorker *worker = MyBgworkerEntry;
 
index 1411c14e9283e9330cae125578f8b89e3d7bff7b..cbcb3dbec36c48fcbf2b80cb735cb3644949fcdb 100644 (file)
@@ -52,9 +52,9 @@ typedef struct
 } basebackup_options;
 
 
-static int64 sendDir(char *path, int basepathlen, bool sizeonly,
+static int64 sendDir(const char *path, int basepathlen, bool sizeonly,
        List *tablespaces, bool sendtblspclinks);
-static bool sendFile(char *readfilename, char *tarfilename,
+static bool sendFile(const char *readfilename, const char *tarfilename,
         struct stat *statbuf, bool missing_ok);
 static void sendFileWithContent(const char *filename, const char *content);
 static int64 _tarWriteHeader(const char *filename, const char *linktarget,
@@ -962,7 +962,7 @@ sendTablespace(char *path, bool sizeonly)
  * as it will be sent separately in the tablespace_map file.
  */
 static int64
-sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
+sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
        bool sendtblspclinks)
 {
    DIR        *dir;
@@ -1207,7 +1207,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
  * and the file did not exist.
  */
 static bool
-sendFile(char *readfilename, char *tarfilename, struct stat *statbuf,
+sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf,
         bool missing_ok)
 {
    FILE       *fp;
index 007d3dabc19feeb0dacac7457f634b72915320cb..247809927adf9b4385de6d29a5540c09f09db8ed 100644 (file)
@@ -56,7 +56,7 @@ static void setRuleCheckAsUser_Query(Query *qry, Oid userid);
  *   relation "pg_rewrite"
  */
 static Oid
-InsertRule(char *rulname,
+InsertRule(const char *rulname,
           int evtype,
           Oid eventrel_oid,
           bool evinstead,
@@ -225,7 +225,7 @@ DefineRule(RuleStmt *stmt, const char *queryString)
  * action and qual have already been passed through parse analysis.
  */
 ObjectAddress
-DefineQueryRewrite(char *rulename,
+DefineQueryRewrite(const char *rulename,
                   Oid event_relid,
                   Node *event_qual,
                   CmdType event_type,
index 7cf668de19e352722a35225466f332de8c1d9b8c..42384b42b123450374d42c34033bcba8cea1110d 100644 (file)
@@ -138,7 +138,7 @@ typedef struct DictSnowball
 
 
 static void
-locate_stem_module(DictSnowball *d, char *lang)
+locate_stem_module(DictSnowball *d, const char *lang)
 {
    const stemmer_module *m;
 
index 6b53b70d333c2f5e7c3f4b15a8ddc5f7e9a11710..e5c3e867099f8bc96af658bcc581bcae94bd00c2 100644 (file)
@@ -111,7 +111,7 @@ extern slock_t *ShmemLock;
  * This is indexed by tranche ID and stores the names of all tranches known
  * to the current backend.
  */
-static char **LWLockTrancheArray = NULL;
+static const char **LWLockTrancheArray = NULL;
 static int LWLockTranchesAllocated = 0;
 
 #define T_NAME(lock) \
@@ -495,7 +495,7 @@ RegisterLWLockTranches(void)
    if (LWLockTrancheArray == NULL)
    {
        LWLockTranchesAllocated = 128;
-       LWLockTrancheArray = (char **)
+       LWLockTrancheArray = (const char **)
            MemoryContextAllocZero(TopMemoryContext,
                                   LWLockTranchesAllocated * sizeof(char *));
        Assert(LWLockTranchesAllocated >= LWTRANCHE_FIRST_USER_DEFINED);
@@ -595,7 +595,7 @@ LWLockNewTrancheId(void)
  * (TopMemoryContext, static variable, or similar).
  */
 void
-LWLockRegisterTranche(int tranche_id, char *tranche_name)
+LWLockRegisterTranche(int tranche_id, const char *tranche_name)
 {
    Assert(LWLockTrancheArray != NULL);
 
@@ -607,7 +607,7 @@ LWLockRegisterTranche(int tranche_id, char *tranche_name)
        while (i <= tranche_id)
            i *= 2;
 
-       LWLockTrancheArray = (char **)
+       LWLockTrancheArray = (const char **)
            repalloc(LWLockTrancheArray, i * sizeof(char *));
        LWLockTranchesAllocated = i;
        while (j < LWLockTranchesAllocated)
index 1b6085add3ac034e06e550b4c2a4b7380766d017..2a458db691794ef756ce7582819d37f90c75c558 100644 (file)
@@ -165,7 +165,7 @@ addWrd(DictThesaurus *d, char *b, char *e, uint32 idsubst, uint16 nwrd, uint16 p
 #define TR_INSUBS  4
 
 static void
-thesaurusRead(char *filename, DictThesaurus *d)
+thesaurusRead(const char *filename, DictThesaurus *d)
 {
    tsearch_readline_state trst;
    uint32      idsubst = 0;
index e82a69d337d4ec38e905355539b5afdd8079a7f8..e70e901066de35958cded643bdb91027f8f798d9 100644 (file)
@@ -450,7 +450,7 @@ getNextFlagFromString(IspellDict *Conf, char **sflagset, char *sflag)
  * otherwise returns false.
  */
 static bool
-IsAffixFlagInUse(IspellDict *Conf, int affix, char *affixflag)
+IsAffixFlagInUse(IspellDict *Conf, int affix, const char *affixflag)
 {
    char       *flagcur;
    char        flag[BUFSIZ];
@@ -596,7 +596,7 @@ NIImportDictionary(IspellDict *Conf, const char *filename)
  * Returns 1 if the word was found in the prefix tree, else returns 0.
  */
 static int
-FindWord(IspellDict *Conf, const char *word, char *affixflag, int flag)
+FindWord(IspellDict *Conf, const char *word, const char *affixflag, int flag)
 {
    SPNode     *node = Conf->Dictionary;
    SPNodeData *StopLow,
index 5285aa54f1cdb341692c92a873f2a0e86a5d1e03..b3b9fc522d3cab703ba337788341157525968323 100644 (file)
@@ -477,7 +477,7 @@ pg_ls_dir_1arg(PG_FUNCTION_ARGS)
 
 /* Generic function to return a directory listing of files */
 static Datum
-pg_ls_dir_files(FunctionCallInfo fcinfo, char *dir)
+pg_ls_dir_files(FunctionCallInfo fcinfo, const char *dir)
 {
    FuncCallContext *funcctx;
    struct dirent *de;
index b543b7046cd0f76f7f43221546e532d1a33bf332..06cf32f5d75be19cd605d1158261db267915b4f6 100644 (file)
@@ -343,7 +343,7 @@ static void set_relation_column_names(deparse_namespace *dpns,
                          deparse_columns *colinfo);
 static void set_join_column_names(deparse_namespace *dpns, RangeTblEntry *rte,
                      deparse_columns *colinfo);
-static bool colname_is_unique(char *colname, deparse_namespace *dpns,
+static bool colname_is_unique(const char *colname, deparse_namespace *dpns,
                  deparse_columns *colinfo);
 static char *make_colname_unique(char *colname, deparse_namespace *dpns,
                    deparse_columns *colinfo);
@@ -4117,7 +4117,7 @@ set_join_column_names(deparse_namespace *dpns, RangeTblEntry *rte,
  * dpns is query-wide info, colinfo is for the column's RTE
  */
 static bool
-colname_is_unique(char *colname, deparse_namespace *dpns,
+colname_is_unique(const char *colname, deparse_namespace *dpns,
                  deparse_columns *colinfo)
 {
    int         i;
index 4674ee2938aab58abb15e30d0271eaa11b3cb7f0..39b68dbc65122eec3a717ae6ccaf9ecc7f9604dc 100644 (file)
@@ -1379,7 +1379,7 @@ text_position_cleanup(TextPositionState *state)
  * whether arg1 is less than, equal to, or greater than arg2.
  */
 int
-varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
+varstr_cmp(const char *arg1, int len1, const char *arg2, int len2, Oid collid)
 {
    int         result;
 
index c9d07f2ae9b2fad5602db15c60ecd234d002c841..56e262819e9792e8daf6ba255532e83f97f5fa44 100644 (file)
@@ -146,7 +146,7 @@ static text *xml_xmlnodetoxmltype(xmlNodePtr cur, PgXmlErrorContext *xmlerrcxt);
 static int xml_xpathobjtoxmlarray(xmlXPathObjectPtr xpathobj,
                       ArrayBuildState *astate,
                       PgXmlErrorContext *xmlerrcxt);
-static xmlChar *pg_xmlCharStrndup(char *str, size_t len);
+static xmlChar *pg_xmlCharStrndup(const char *str, size_t len);
 #endif                         /* USE_LIBXML */
 
 static void xmldata_root_element_start(StringInfo result, const char *eltname,
@@ -192,11 +192,11 @@ typedef struct XmlTableBuilderData
 
 static void XmlTableInitOpaque(struct TableFuncScanState *state, int natts);
 static void XmlTableSetDocument(struct TableFuncScanState *state, Datum value);
-static void XmlTableSetNamespace(struct TableFuncScanState *state, char *name,
-                    char *uri);
-static void XmlTableSetRowFilter(struct TableFuncScanState *state, char *path);
+static void XmlTableSetNamespace(struct TableFuncScanState *state, const char *name,
+                    const char *uri);
+static void XmlTableSetRowFilter(struct TableFuncScanState *state, const char *path);
 static void XmlTableSetColumnFilter(struct TableFuncScanState *state,
-                       char *path, int colnum);
+                       const char *path, int colnum);
 static bool XmlTableFetchRow(struct TableFuncScanState *state);
 static Datum XmlTableGetValue(struct TableFuncScanState *state, int colnum,
                 Oid typid, int32 typmod, bool *isnull);
@@ -765,7 +765,7 @@ xmlparse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace)
 
 
 xmltype *
-xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null)
+xmlpi(const char *target, text *arg, bool arg_is_null, bool *result_is_null)
 {
 #ifdef USE_LIBXML
    xmltype    *result;
@@ -1164,7 +1164,7 @@ xml_pnstrdup(const xmlChar *str, size_t len)
 
 /* Ditto, except input is char* */
 static xmlChar *
-pg_xmlCharStrndup(char *str, size_t len)
+pg_xmlCharStrndup(const char *str, size_t len)
 {
    xmlChar    *result;
 
@@ -1850,7 +1850,7 @@ appendStringInfoLineSeparator(StringInfo str)
  * Convert one char in the current server encoding to a Unicode codepoint.
  */
 static pg_wchar
-sqlchar_to_unicode(char *s)
+sqlchar_to_unicode(const char *s)
 {
    char       *utf8string;
    pg_wchar    ret[2];         /* need space for trailing zero */
@@ -1894,12 +1894,12 @@ is_valid_xml_namechar(pg_wchar c)
  * Map SQL identifier to XML name; see SQL/XML:2008 section 9.1.
  */
 char *
-map_sql_identifier_to_xml_name(char *ident, bool fully_escaped,
+map_sql_identifier_to_xml_name(const char *ident, bool fully_escaped,
                               bool escape_period)
 {
 #ifdef USE_LIBXML
    StringInfoData buf;
-   char       *p;
+   const char *p;
 
    /*
     * SQL/XML doesn't make use of this case anywhere, so it's probably a
@@ -1970,10 +1970,10 @@ unicode_to_sqlchar(pg_wchar c)
  * Map XML name to SQL identifier; see SQL/XML:2008 section 9.3.
  */
 char *
-map_xml_name_to_sql_identifier(char *name)
+map_xml_name_to_sql_identifier(const char *name)
 {
    StringInfoData buf;
-   char       *p;
+   const char *p;
 
    initStringInfo(&buf);
 
@@ -3009,7 +3009,7 @@ database_to_xml_and_xmlschema(PG_FUNCTION_ARGS)
  * 9.2.
  */
 static char *
-map_multipart_sql_identifier_to_xml_name(char *a, char *b, char *c, char *d)
+map_multipart_sql_identifier_to_xml_name(const char *a, const char *b, const char *c, const char *d)
 {
    StringInfoData result;
 
@@ -4292,7 +4292,7 @@ XmlTableSetDocument(TableFuncScanState *state, Datum value)
  *     Add a namespace declaration
  */
 static void
-XmlTableSetNamespace(TableFuncScanState *state, char *name, char *uri)
+XmlTableSetNamespace(TableFuncScanState *state, const char *name, const char *uri)
 {
 #ifdef USE_LIBXML
    XmlTableBuilderData *xtCxt;
@@ -4318,7 +4318,7 @@ XmlTableSetNamespace(TableFuncScanState *state, char *name, char *uri)
  *     Install the row-filter Xpath expression.
  */
 static void
-XmlTableSetRowFilter(TableFuncScanState *state, char *path)
+XmlTableSetRowFilter(TableFuncScanState *state, const char *path)
 {
 #ifdef USE_LIBXML
    XmlTableBuilderData *xtCxt;
@@ -4347,7 +4347,7 @@ XmlTableSetRowFilter(TableFuncScanState *state, char *path)
  *     Install the column-filter Xpath expression, for the given column.
  */
 static void
-XmlTableSetColumnFilter(TableFuncScanState *state, char *path, int colnum)
+XmlTableSetColumnFilter(TableFuncScanState *state, const char *path, int colnum)
 {
 #ifdef USE_LIBXML
    XmlTableBuilderData *xtCxt;
index 27fcf5a87f742a44bc35a01c6ac7d66ef418af7b..bb2bc065ef96a800b49cf9d9882c3f3ff810f623 100644 (file)
@@ -239,10 +239,10 @@ static void writefile(char *path, char **lines);
 static FILE *popen_check(const char *command, const char *mode);
 static void exit_nicely(void);
 static char *get_id(void);
-static int get_encoding_id(char *encoding_name);
-static void set_input(char **dest, char *filename);
+static int get_encoding_id(const char *encoding_name);
+static void set_input(char **dest, const char *filename);
 static void check_input(char *path);
-static void write_version_file(char *extrapath);
+static void write_version_file(const char *extrapath);
 static void set_null_conf(void);
 static void test_config_settings(void);
 static void setup_config(void);
@@ -640,7 +640,7 @@ encodingid_to_string(int enc)
  * get the encoding id for a given encoding name
  */
 static int
-get_encoding_id(char *encoding_name)
+get_encoding_id(const char *encoding_name)
 {
    int         enc;
 
@@ -751,7 +751,7 @@ find_matching_ts_config(const char *lc_type)
  * set name of given input file variable under data directory
  */
 static void
-set_input(char **dest, char *filename)
+set_input(char **dest, const char *filename)
 {
    *dest = psprintf("%s/%s", share_path, filename);
 }
@@ -801,7 +801,7 @@ check_input(char *path)
  * if extrapath is not NULL
  */
 static void
-write_version_file(char *extrapath)
+write_version_file(const char *extrapath)
 {
    FILE       *version_file;
    char       *path;
index befcde4630603554340091193f4642abc6be80b9..216853d62728d573b35c165a0e334c79dcef9583 100644 (file)
@@ -419,7 +419,7 @@ ExecuteSqlQuery(Archive *AHX, const char *query, ExecStatusType status)
  * Execute an SQL query and verify that we got exactly one row back.
  */
 PGresult *
-ExecuteSqlQueryForSingleRow(Archive *fout, char *query)
+ExecuteSqlQueryForSingleRow(Archive *fout, const char *query)
 {
    PGresult   *res;
    int         ntups;
index 527449e04401314006c00631d81b377663cf1e08..a79f5283fe524cada9d35d2a23767b8846a5ca34 100644 (file)
@@ -16,7 +16,7 @@ extern int    ExecuteSqlCommandBuf(Archive *AHX, const char *buf, size_t bufLen);
 extern void ExecuteSqlStatement(Archive *AHX, const char *query);
 extern PGresult *ExecuteSqlQuery(Archive *AHX, const char *query,
                ExecStatusType status);
-extern PGresult *ExecuteSqlQueryForSingleRow(Archive *fout, char *query);
+extern PGresult *ExecuteSqlQueryForSingleRow(Archive *fout, const char *query);
 
 extern void EndDBCopyMode(Archive *AHX, const char *tocEntryTag);
 
index e9353d88661811e1a3766174dc610b0201546a16..13553e3b5a4bba3c0cbc9ce416fefdd97cc61a04 100644 (file)
@@ -51,7 +51,7 @@ executeFileMap(void)
  * handy for text files.
  */
 char *
-fetchFile(char *filename, size_t *filesize)
+fetchFile(const char *filename, size_t *filesize)
 {
    if (datadir_source)
        return slurpFile(datadir_source, filename, filesize);
index 1e08f76b3e942994ac2ff596efe65febbd7252b2..7288120a0bde2f26c7f81cde533c90792b7f6e12 100644 (file)
@@ -24,7 +24,7 @@
  * config options.
  */
 extern void fetchSourceFileList(void);
-extern char *fetchFile(char *filename, size_t *filesize);
+extern char *fetchFile(const char *filename, size_t *filesize);
 extern void executeFileMap(void);
 
 /* in libpq_fetch.c */
index c74eb25e18ce29d896b6e341e7a56a16596ab05d..f7f2ebdacfadb2673db52e24bba6b86f703191f0 100644 (file)
@@ -22,7 +22,7 @@
 
 static void usage(void);
 static void check_required_directory(char **dirpath, char **configpath,
-                        char *envVarName, char *cmdLineOption, char *description);
+                        const char *envVarName, const char *cmdLineOption, const char *description);
 #define FIX_DEFAULT_READ_ONLY "-c default_transaction_read_only=false"
 
 
@@ -341,8 +341,8 @@ usage(void)
  */
 static void
 check_required_directory(char **dirpath, char **configpath,
-                        char *envVarName, char *cmdLineOption,
-                        char *description)
+                        const char *envVarName, const char *cmdLineOption,
+                        const char *description)
 {
    if (*dirpath == NULL || strlen(*dirpath) == 0)
    {
index d44fefb457ba31b33d959ae62190d3a678f62320..c10103f0bff4117f6f098d9cc1b32f762a4fa102 100644 (file)
@@ -363,7 +363,7 @@ create_new_objects(void)
  * Delete the given subdirectory contents from the new cluster
  */
 static void
-remove_new_subdir(char *subdir, bool rmtopdir)
+remove_new_subdir(const char *subdir, bool rmtopdir)
 {
    char        new_path[MAXPGPATH];
 
@@ -380,7 +380,7 @@ remove_new_subdir(char *subdir, bool rmtopdir)
  * Copy the files from the old cluster into it
  */
 static void
-copy_subdir_files(char *old_subdir, char *new_subdir)
+copy_subdir_files(const char *old_subdir, const char *new_subdir)
 {
    char        old_path[MAXPGPATH];
    char        new_path[MAXPGPATH];
index 53eca4c8e0206b65a97ca4de15176c906954bdb1..6443eda6dfef4cbb11af40eccd2f92f204b81146 100644 (file)
@@ -175,7 +175,7 @@ open_file_in_directory(const char *directory, const char *fname)
  * wal segment size.
  */
 static bool
-search_directory(char *directory, char *fname)
+search_directory(const char *directory, const char *fname)
 {
    int         fd = -1;
    DIR        *xldir;
index d4a60351a86f45cf565e204c6c62e69a51c80431..ec56a74de06542518132a843bc0c2352f5769c87 100644 (file)
@@ -1870,7 +1870,7 @@ preparedStatementName(char *buffer, int file, int state)
 }
 
 static void
-commandFailed(CState *st, char *message)
+commandFailed(CState *st, const char *message)
 {
    fprintf(stderr,
            "client %d aborted in command %d of script %d; %s\n",
@@ -3538,7 +3538,7 @@ addScript(ParsedScript script)
 }
 
 static void
-printSimpleStats(char *prefix, SimpleStats *ss)
+printSimpleStats(const char *prefix, SimpleStats *ss)
 {
    /* print NaN if no transactions where executed */
    double      latency = ss->sum / ss->count;
index bfef2df4206015e5aa1ab82c26eacc91dd8329a8..eb1c6728d4a26f33c54c3e7f8211664905b017c2 100644 (file)
@@ -503,7 +503,7 @@ extern void gistSplitByKey(Relation r, Page page, IndexTuple *itup,
 /* gistbuild.c */
 extern IndexBuildResult *gistbuild(Relation heap, Relation index,
          struct IndexInfo *indexInfo);
-extern void gistValidateBufferingOption(char *value);
+extern void gistValidateBufferingOption(const char *value);
 
 /* gistbuildbuffers.c */
 extern GISTBuildBuffers *gistInitBuildBuffers(int pagesPerBuffer, int levelStep,
index 5cdaa3bff1fb5f15f90ac6b1414a19ef41ca4a1a..cd43e3a52e8ac9be7954b90c280bf8781cc35f27 100644 (file)
@@ -108,7 +108,7 @@ typedef struct relopt_real
 } relopt_real;
 
 /* validation routines for strings */
-typedef void (*validate_string_relopt) (char *value);
+typedef void (*validate_string_relopt) (const char *value);
 
 typedef struct relopt_string
 {
@@ -246,17 +246,17 @@ typedef struct
 
 
 extern relopt_kind add_reloption_kind(void);
-extern void add_bool_reloption(bits32 kinds, char *name, char *desc,
+extern void add_bool_reloption(bits32 kinds, const char *name, const char *desc,
                   bool default_val);
-extern void add_int_reloption(bits32 kinds, char *name, char *desc,
+extern void add_int_reloption(bits32 kinds, const char *name, const char *desc,
                  int default_val, int min_val, int max_val);
-extern void add_real_reloption(bits32 kinds, char *name, char *desc,
+extern void add_real_reloption(bits32 kinds, const char *name, const char *desc,
                   double default_val, double min_val, double max_val);
-extern void add_string_reloption(bits32 kinds, char *name, char *desc,
-                    char *default_val, validate_string_relopt validator);
+extern void add_string_reloption(bits32 kinds, const char *name, const char *desc,
+                    const char *default_val, validate_string_relopt validator);
 
 extern Datum transformRelOptions(Datum oldOptions, List *defList,
-                   char *namspace, char *validnsps[],
+                   const char *namspace, char *validnsps[],
                    bool ignoreOids, bool isReset);
 extern List *untransformRelOptions(Datum options);
 extern bytea *extractRelOptions(HeapTuple tuple, TupleDesc tupdesc,
index f2c10f905fc7d6845f7f0968857933d0ad7b2043..118b0a8432f2a82ab7a190e96ad11d21ed6a35fc 100644 (file)
@@ -350,14 +350,14 @@ extern void CommitTransactionCommand(void);
 extern void AbortCurrentTransaction(void);
 extern void BeginTransactionBlock(void);
 extern bool EndTransactionBlock(void);
-extern bool PrepareTransactionBlock(char *gid);
+extern bool PrepareTransactionBlock(const char *gid);
 extern void UserAbortTransactionBlock(void);
 extern void BeginImplicitTransactionBlock(void);
 extern void EndImplicitTransactionBlock(void);
 extern void ReleaseSavepoint(List *options);
-extern void DefineSavepoint(char *name);
+extern void DefineSavepoint(const char *name);
 extern void RollbackToSavepoint(List *options);
-extern void BeginInternalSubTransaction(char *name);
+extern void BeginInternalSubTransaction(const char *name);
 extern void ReleaseCurrentSubTransaction(void);
 extern void RollbackAndReleaseCurrentSubTransaction(void);
 extern bool IsSubTransaction(void);
index 22a8e63658e0022a00db390fa6244ca45806d399..7805c3c7471401dd925616bd511beacfdf439a1d 100644 (file)
@@ -321,9 +321,9 @@ extern char *recoveryRestoreCommand;
 extern bool RestoreArchivedFile(char *path, const char *xlogfname,
                    const char *recovername, off_t expectedSize,
                    bool cleanupEnabled);
-extern void ExecuteRecoveryCommand(char *command, char *commandName,
+extern void ExecuteRecoveryCommand(const char *command, const char *commandName,
                       bool failOnerror);
-extern void KeepFileRestoredFromArchive(char *path, char *xlogfname);
+extern void KeepFileRestoredFromArchive(const char *path, const char *xlogfname);
 extern void XLogArchiveNotify(const char *xlog);
 extern void XLogArchiveNotifySeg(XLogSegNo segno);
 extern void XLogArchiveForceDone(const char *xlog);
index cb1bc887f8a4b82a5ce638ce73d7d23d4f62b99a..0fae02295b1b104eee4ef09a97174ccf94e90b0d 100644 (file)
@@ -109,7 +109,7 @@ extern Node *cookDefault(ParseState *pstate,
            Node *raw_default,
            Oid atttypid,
            int32 atttypmod,
-           char *attname);
+           const char *attname);
 
 extern void DeleteRelationTuple(Oid relid);
 extern void DeleteAttributeTuples(Oid relid);
index 85bd80151362dcc812c8f95171f41a7ee38321c1..0caf0e81ab94c10aecc85ab450dd0db35e98cf29 100644 (file)
@@ -34,11 +34,11 @@ extern ObjectAddress CommentObject(CommentStmt *stmt);
 
 extern void DeleteComments(Oid oid, Oid classoid, int32 subid);
 
-extern void CreateComments(Oid oid, Oid classoid, int32 subid, char *comment);
+extern void CreateComments(Oid oid, Oid classoid, int32 subid, const char *comment);
 
 extern void DeleteSharedComments(Oid oid, Oid classoid);
 
-extern void CreateSharedComments(Oid oid, Oid classoid, char *comment);
+extern void CreateSharedComments(Oid oid, Oid classoid, const char *comment);
 
 extern char *GetComment(Oid oid, Oid classoid, int32 subid);
 
index f7bb4a54f7752ab28e2fda7e6f20c75960a376e5..bfead9af3d1bbd0c242abaab56f6ebe23dd679aa 100644 (file)
@@ -39,12 +39,12 @@ extern char *makeObjectName(const char *name1, const char *name2,
 extern char *ChooseRelationName(const char *name1, const char *name2,
                   const char *label, Oid namespaceid);
 extern bool CheckIndexCompatible(Oid oldId,
-                    char *accessMethodName,
+                    const char *accessMethodName,
                     List *attributeList,
                     List *exclusionOpNames);
 extern Oid GetDefaultOpClass(Oid type_id, Oid am_id);
 extern Oid ResolveOpClass(List *opclass, Oid attrType,
-              char *accessMethodName, Oid accessMethodId);
+              const char *accessMethodName, Oid accessMethodId);
 
 /* commands/functioncmds.c */
 extern ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt);
index 8f3fc6553637f464164ccb35659e887e5af1b4e7..9fbf38629dfec0af024519afa59daad23e42043e 100644 (file)
@@ -34,7 +34,7 @@ extern ObjectAddress AlterDomainDefault(List *names, Node *defaultRaw);
 extern ObjectAddress AlterDomainNotNull(List *names, bool notNull);
 extern ObjectAddress AlterDomainAddConstraint(List *names, Node *constr,
                         ObjectAddress *constrAddr);
-extern ObjectAddress AlterDomainValidateConstraint(List *names, char *constrName);
+extern ObjectAddress AlterDomainValidateConstraint(List *names, const char *constrName);
 extern ObjectAddress AlterDomainDropConstraint(List *names, const char *constrName,
                          DropBehavior behavior, bool missing_ok);
 
index cf08ce2ac711c1903b2d0d8be02620c16512a33f..46d762db220e63cbebdc2e1247fa4063c4bcd931 100644 (file)
@@ -17,7 +17,7 @@
 #include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
-extern void validateWithCheckOption(char *value);
+extern void validateWithCheckOption(const char *value);
 
 extern ObjectAddress DefineView(ViewStmt *stmt, const char *queryString,
           int stmt_location, int stmt_len);
index a24a555b7579bd5aa3ba1a624a52d3f6cafb2ebb..49e8c7c1b2ab17c1149b20494bc29b0e76149caa 100644 (file)
@@ -53,11 +53,11 @@ typedef struct TableFuncRoutine
 {
    void        (*InitOpaque) (struct TableFuncScanState *state, int natts);
    void        (*SetDocument) (struct TableFuncScanState *state, Datum value);
-   void        (*SetNamespace) (struct TableFuncScanState *state, char *name,
-                                char *uri);
-   void        (*SetRowFilter) (struct TableFuncScanState *state, char *path);
+   void        (*SetNamespace) (struct TableFuncScanState *state, const char *name,
+                                const char *uri);
+   void        (*SetRowFilter) (struct TableFuncScanState *state, const char *path);
    void        (*SetColumnFilter) (struct TableFuncScanState *state,
-                                   char *path, int colnum);
+                                   const char *path, int colnum);
    bool        (*FetchRow) (struct TableFuncScanState *state);
    Datum       (*GetValue) (struct TableFuncScanState *state, int colnum,
                             Oid typid, int32 typmod, bool *isnull);
index 91542d4f15a6ca733900c3ef5700cd8d1cb514b6..290f3b78cb5753672175781692a72e88286c073a 100644 (file)
@@ -54,9 +54,9 @@ extern RangeTblEntry *GetRTEByRangeTablePosn(ParseState *pstate,
 extern CommonTableExpr *GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte,
             int rtelevelsup);
 extern Node *scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte,
-                char *colname, int location,
+                const char *colname, int location,
                 int fuzzy_rte_penalty, FuzzyAttrMatchState *fuzzystate);
-extern Node *colNameToVar(ParseState *pstate, char *colname, bool localonly,
+extern Node *colNameToVar(ParseState *pstate, const char *colname, bool localonly,
             int location);
 extern void markVarForSelectPriv(ParseState *pstate, Var *var,
                     RangeTblEntry *rte);
@@ -117,7 +117,7 @@ extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte,
              bool addToRelNameSpace, bool addToVarNameSpace);
 extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn();
 extern void errorMissingColumn(ParseState *pstate,
-                  char *relname, char *colname, int location) pg_attribute_noreturn();
+                  const char *relname, const char *colname, int location) pg_attribute_noreturn();
 extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
          int location, bool include_dropped,
          List **colnames, List **colvars);
index 44af46b1aaa043bd65a226e48ba066a6f1e32d72..bb7b7b606bddb6cc5f2c8d726ecb129cffe6a7f6 100644 (file)
@@ -28,7 +28,7 @@ extern TargetEntry *transformTargetEntry(ParseState *pstate,
                     char *colname, bool resjunk);
 extern Expr *transformAssignedExpr(ParseState *pstate, Expr *expr,
                      ParseExprKind exprKind,
-                     char *colname,
+                     const char *colname,
                      int attrno,
                      List *indirection,
                      int location);
index 6b4e631880d1556c4478fdf5de81c133a5d6d50b..b6c5800cfee97e923b8e22d9b400efb716f6ef71 100644 (file)
@@ -140,7 +140,7 @@ extern PGDLLIMPORT BackgroundWorker *MyBgworkerEntry;
  * If dbname is NULL, connection is made to no specific database;
  * only shared catalogs can be accessed.
  */
-extern void BackgroundWorkerInitializeConnection(char *dbname, char *username);
+extern void BackgroundWorkerInitializeConnection(const char *dbname, const char *username);
 
 /* Just like the above, but specifying database and user by OID. */
 extern void BackgroundWorkerInitializeConnectionByOid(Oid dboid, Oid useroid);
index 2e25288bb4b02bb80351ee6c81ca1a80a2bb7ead..b496a0c1549b9605088cb70d2878e99cff44bcef 100644 (file)
@@ -25,7 +25,7 @@
 
 extern ObjectAddress DefineRule(RuleStmt *stmt, const char *queryString);
 
-extern ObjectAddress DefineQueryRewrite(char *rulename,
+extern ObjectAddress DefineQueryRewrite(const char *rulename,
                   Oid event_relid,
                   Node *event_qual,
                   CmdType event_type,
index f4c4aed7f91d48f51d347da1afb5c62f38606373..596fdadc6323abcfbe2d543a16bb03889f6f315c 100644 (file)
@@ -184,7 +184,7 @@ extern LWLockPadded *GetNamedLWLockTranche(const char *tranche_name);
  * registration in the main shared memory segment wouldn't work for that case.
  */
 extern int LWLockNewTrancheId(void);
-extern void LWLockRegisterTranche(int tranche_id, char *tranche_name);
+extern void LWLockRegisterTranche(int tranche_id, const char *tranche_name);
 extern void LWLockInitialize(LWLock *lock, int tranche_id);
 
 /*
index 6c9287b61127cbbe986ea6d415d4958a4b11a4a9..80ac1e3fe63105540a990d1fb3f154159b6aad8a 100644 (file)
@@ -17,8 +17,8 @@
 #include "fmgr.h"
 
 
-extern void *pg_dlopen(char *filename);
-extern PGFunction pg_dlsym(void *handle, char *funcname);
+extern void *pg_dlopen(const char *filename);
+extern PGFunction pg_dlsym(void *handle, const char *funcname);
 extern void pg_dlclose(void *handle);
 extern char *pg_dlerror(void);
 
index cab82ee888bb3f3e2b1d2cbf35003978075bb49f..06f3b69893c24bb402be9a3533071403c39f1712 100644 (file)
@@ -16,7 +16,7 @@
 #include "nodes/pg_list.h"
 #include "utils/sortsupport.h"
 
-extern int varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid);
+extern int varstr_cmp(const char *arg1, int len1, const char *arg2, int len2, Oid collid);
 extern void varstr_sortsupport(SortSupport ssup, Oid collid, bool bpchar);
 extern int varstr_levenshtein(const char *source, int slen,
                   const char *target, int tlen,
index e6fa0e2051bea8117aae643947176415107af1f6..385b728f421ed4e8d9516571a282dbda363371f3 100644 (file)
@@ -65,14 +65,14 @@ extern xmltype *xmlelement(XmlExpr *xexpr,
           Datum *named_argvalue, bool *named_argnull,
           Datum *argvalue, bool *argnull);
 extern xmltype *xmlparse(text *data, XmlOptionType xmloption, bool preserve_whitespace);
-extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null);
+extern xmltype *xmlpi(const char *target, text *arg, bool arg_is_null, bool *result_is_null);
 extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
 extern bool xml_is_document(xmltype *arg);
 extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg);
 extern char *escape_xml(const char *str);
 
-extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period);
-extern char *map_xml_name_to_sql_identifier(char *name);
+extern char *map_sql_identifier_to_xml_name(const char *ident, bool fully_escaped, bool escape_period);
+extern char *map_xml_name_to_sql_identifier(const char *name);
 extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings);
 
 extern int xmlbinary;          /* XmlBinaryType, but int for guc enum */
index e9bcb4cde2500b8bec65aa85c2b08a1beadf17c8..13058cf7bf762600299d12228dbdc6b829011cc5 100644 (file)
@@ -195,7 +195,7 @@ ecpg_strndup(const char *str, size_t len)
 }
 
 int
-deccvasc(char *cp, int len, decimal *np)
+deccvasc(const char *cp, int len, decimal *np)
 {
    char       *str;
    int         ret = 0;
@@ -520,7 +520,7 @@ rdatestr(date d, char *str)
 *
 */
 int
-rstrdate(char *str, date * d)
+rstrdate(const char *str, date * d)
 {
    return rdefmtdate(d, "mm/dd/yyyy", str);
 }
@@ -545,7 +545,7 @@ rjulmdy(date d, short mdy[3])
 }
 
 int
-rdefmtdate(date * d, char *fmt, char *str)
+rdefmtdate(date * d, const char *fmt, const char *str)
 {
    /* TODO: take care of DBCENTURY environment variable */
    /* PGSQL functions allow all centuries */
@@ -571,7 +571,7 @@ rdefmtdate(date * d, char *fmt, char *str)
 }
 
 int
-rfmtdate(date d, char *fmt, char *str)
+rfmtdate(date d, const char *fmt, char *str)
 {
    errno = 0;
    if (PGTYPESdate_fmt_asc(d, fmt, str) == 0)
@@ -747,7 +747,7 @@ initValue(long lng_val)
 
 /* return the position oft the right-most dot in some string */
 static int
-getRightMostDot(char *str)
+getRightMostDot(const char *str)
 {
    size_t      len = strlen(str);
    int         i,
@@ -765,7 +765,7 @@ getRightMostDot(char *str)
 
 /* And finally some misc functions */
 int
-rfmtlong(long lng_val, char *fmt, char *outbuf)
+rfmtlong(long lng_val, const char *fmt, char *outbuf)
 {
    size_t      fmt_len = strlen(fmt);
    size_t      temp_len;
@@ -1047,7 +1047,7 @@ rsetnull(int t, char *ptr)
 }
 
 int
-risnull(int t, char *ptr)
+risnull(int t, const char *ptr)
 {
    return ECPGis_noind_null(t, ptr);
 }
index a0257c8957d5e7f9e7ac7a35219a31b18d785483..be9cac6e7b4a46e92331cf7d8bdc507acb93ef17 100644 (file)
@@ -375,7 +375,7 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr)
 }
 
 static bool
-_check(unsigned char *ptr, int length)
+_check(const unsigned char *ptr, int length)
 {
    for (length--; length >= 0; length--)
        if (ptr[length] != 0xff)
@@ -385,36 +385,36 @@ _check(unsigned char *ptr, int length)
 }
 
 bool
-ECPGis_noind_null(enum ECPGttype type, void *ptr)
+ECPGis_noind_null(enum ECPGttype type, const void *ptr)
 {
    switch (type)
    {
        case ECPGt_char:
        case ECPGt_unsigned_char:
        case ECPGt_string:
-           if (*((char *) ptr) == '\0')
+           if (*((const char *) ptr) == '\0')
                return true;
            break;
        case ECPGt_short:
        case ECPGt_unsigned_short:
-           if (*((short int *) ptr) == SHRT_MIN)
+           if (*((const short int *) ptr) == SHRT_MIN)
                return true;
            break;
        case ECPGt_int:
        case ECPGt_unsigned_int:
-           if (*((int *) ptr) == INT_MIN)
+           if (*((const int *) ptr) == INT_MIN)
                return true;
            break;
        case ECPGt_long:
        case ECPGt_unsigned_long:
        case ECPGt_date:
-           if (*((long *) ptr) == LONG_MIN)
+           if (*((const long *) ptr) == LONG_MIN)
                return true;
            break;
 #ifdef HAVE_LONG_LONG_INT
        case ECPGt_long_long:
        case ECPGt_unsigned_long_long:
-           if (*((long long *) ptr) == LONG_LONG_MIN)
+           if (*((const long long *) ptr) == LONG_LONG_MIN)
                return true;
            break;
 #endif                         /* HAVE_LONG_LONG_INT */
@@ -425,15 +425,15 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr)
            return _check(ptr, sizeof(double));
            break;
        case ECPGt_varchar:
-           if (*(((struct ECPGgeneric_varchar *) ptr)->arr) == 0x00)
+           if (*(((const struct ECPGgeneric_varchar *) ptr)->arr) == 0x00)
                return true;
            break;
        case ECPGt_decimal:
-           if (((decimal *) ptr)->sign == NUMERIC_NULL)
+           if (((const decimal *) ptr)->sign == NUMERIC_NULL)
                return true;
            break;
        case ECPGt_numeric:
-           if (((numeric *) ptr)->sign == NUMERIC_NULL)
+           if (((const numeric *) ptr)->sign == NUMERIC_NULL)
                return true;
            break;
        case ECPGt_interval:
index dd6258152ae02bfaee9ba8c9d2bc5c2a6f81be01..a5260a5542762b69872a55e975a0be5566cf991d 100644 (file)
@@ -36,15 +36,15 @@ extern "C"
 extern int rdatestr(date, char *);
 extern void rtoday(date *);
 extern int rjulmdy(date, short *);
-extern int rdefmtdate(date *, char *, char *);
-extern int rfmtdate(date, char *, char *);
+extern int rdefmtdate(date *, const char *, const char *);
+extern int rfmtdate(date, const char *, char *);
 extern int rmdyjul(short *, date *);
-extern int rstrdate(char *, date *);
+extern int rstrdate(const char *, date *);
 extern int rdayofweek(date);
 
-extern int rfmtlong(long, char *, char *);
+extern int rfmtlong(long, const char *, char *);
 extern int rgetmsg(int, char *, int);
-extern int risnull(int, char *);
+extern int risnull(int, const char *);
 extern int rsetnull(int, char *);
 extern int rtypalign(int, int);
 extern int rtypmsize(int, int);
@@ -62,7 +62,7 @@ extern void ECPG_informix_reset_sqlca(void);
 int            decadd(decimal *, decimal *, decimal *);
 int            deccmp(decimal *, decimal *);
 void       deccopy(decimal *, decimal *);
-int            deccvasc(char *, int, decimal *);
+int            deccvasc(const char *, int, decimal *);
 int            deccvdbl(double, decimal *);
 int            deccvint(int, decimal *);
 int            deccvlong(long, decimal *);
index 536b7506ffa1b607a9b082607009a7ce9f6d9d69..8a601996d2d2b5ad528cc67ade42fc52dab93fed 100644 (file)
@@ -80,7 +80,7 @@ bool      ECPGset_desc_header(int, const char *, int);
 bool       ECPGset_desc(int, const char *, int,...);
 
 void       ECPGset_noind_null(enum ECPGttype, void *);
-bool       ECPGis_noind_null(enum ECPGttype, void *);
+bool       ECPGis_noind_null(enum ECPGttype, const void *);
 bool       ECPGdescribe(int, int, bool, const char *, const char *,...);
 
 void       ECPGset_var(int, void *, int);
index 3d1a181b2b70c4f88665c3f570c173ae309f0950..caf8a33d12589ccc785cf2ce642434b336d3c43b 100644 (file)
@@ -21,7 +21,7 @@ extern void PGTYPESdate_julmdy(date, int *);
 extern void PGTYPESdate_mdyjul(int *, date *);
 extern int PGTYPESdate_dayofweek(date);
 extern void PGTYPESdate_today(date *);
-extern int PGTYPESdate_defmt_asc(date *, const char *, char *);
+extern int PGTYPESdate_defmt_asc(date *, const char *, const char *);
 extern int PGTYPESdate_fmt_asc(date, const char *, char *);
 
 #ifdef __cplusplus
index 283ecca25eb37dece4e3f08d07accfa652881b80..1545be4ee9be3418af3a70e1af10bb8ef5785fe0 100644 (file)
@@ -19,7 +19,7 @@ extern char *PGTYPEStimestamp_to_asc(timestamp);
 extern int PGTYPEStimestamp_sub(timestamp *, timestamp *, interval *);
 extern int PGTYPEStimestamp_fmt_asc(timestamp *, char *, int, const char *);
 extern void PGTYPEStimestamp_current(timestamp *);
-extern int PGTYPEStimestamp_defmt_asc(char *, const char *, timestamp *);
+extern int PGTYPEStimestamp_defmt_asc(const char *, const char *, timestamp *);
 extern int PGTYPEStimestamp_add_interval(timestamp * tin, interval * span, timestamp * tout);
 extern int PGTYPEStimestamp_sub_interval(timestamp * tin, interval * span, timestamp * tout);
 
index c2f78f5a56cd863b05244f45b33ba2b6b1880577..1e692a5f9efdb197fe344d27cc9adc036abc739a 100644 (file)
@@ -329,7 +329,7 @@ PGTYPESdate_fmt_asc(date dDate, const char *fmtstring, char *outbuf)
 
 #define PGTYPES_DATE_MONTH_MAXLENGTH       20  /* probably even less  :-) */
 int
-PGTYPESdate_defmt_asc(date * d, const char *fmt, char *str)
+PGTYPESdate_defmt_asc(date * d, const char *fmt, const char *str)
 {
    /*
     * token[2] = { 4,6 } means that token 2 starts at position 4 and ends at
index 41976a188afe1ed50feda0690fc8d82863414300..24a2f36d4db5941a20f9eb8721925e4b97ea2a63 100644 (file)
@@ -65,7 +65,7 @@ AdjustFractDays(double frac, struct /* pg_ */ tm *tm, fsec_t *fsec, int scale)
 
 /* copy&pasted from .../src/backend/utils/adt/datetime.c */
 static int
-ParseISO8601Number(char *str, char **endptr, int *ipart, double *fpart)
+ParseISO8601Number(const char *str, char **endptr, int *ipart, double *fpart)
 {
    double      val;
 
@@ -90,7 +90,7 @@ ParseISO8601Number(char *str, char **endptr, int *ipart, double *fpart)
 
 /* copy&pasted from .../src/backend/utils/adt/datetime.c */
 static int
-ISO8601IntegerWidth(char *fieldstart)
+ISO8601IntegerWidth(const char *fieldstart)
 {
    /* We might have had a leading '-' */
    if (*fieldstart == '-')
index b63880dc55d5e1e9f808f2e6b9bd8276e5d221f8..abccc268dccea79348c1cb312be4ab6bdd00b462 100644 (file)
@@ -813,7 +813,7 @@ PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv)
 }
 
 int
-PGTYPEStimestamp_defmt_asc(char *str, const char *fmt, timestamp * d)
+PGTYPEStimestamp_defmt_asc(const char *str, const char *fmt, timestamp * d)
 {
    int         year,
                month,
index 256a3c395c5509d338ab6980ccc8cf04ed290565..4abbf93d191c892ad42ae26e783c255b4ea94c8c 100644 (file)
@@ -74,7 +74,7 @@ ECPGstruct_member_dup(struct ECPGstruct_member *rm)
 
 /* The NAME argument is copied. The type argument is preserved as a pointer. */
 void
-ECPGmake_struct_member(char *name, struct ECPGtype *type, struct ECPGstruct_member **start)
+ECPGmake_struct_member(const char *name, struct ECPGtype *type, struct ECPGstruct_member **start)
 {
    struct ECPGstruct_member *ptr,
               *ne =
index 4b93336480714068ce74db3f3ebf1fa9d7a8729b..fc70d7d2182434c5c35c1152187d482dbae529e5 100644 (file)
@@ -33,7 +33,7 @@ struct ECPGtype
 };
 
 /* Everything is malloced. */
-void       ECPGmake_struct_member(char *, struct ECPGtype *, struct ECPGstruct_member **);
+void       ECPGmake_struct_member(const char *, struct ECPGtype *, struct ECPGstruct_member **);
 struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, char *, int);
 struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, char *);
 struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *, char *);
index f1a90488890ec85bcf52fcef9b7ce74aaeef3bee..a147f405ab09aa3932154b86bed46d1b5d02c75d 100644 (file)
@@ -13,7 +13,7 @@ static void
 check_return(int ret);
 
 static void
-date_test_strdate(char *input)
+date_test_strdate(const char *input)
 {
    static int i;
    date d;
@@ -38,7 +38,7 @@ date_test_strdate(char *input)
 }
 
 static void
-date_test_defmt(char *fmt, char *input)
+date_test_defmt(const char *fmt, const char *input)
 {
    static int i;
    char dbuf[11];
@@ -63,7 +63,7 @@ date_test_defmt(char *fmt, char *input)
 }
 
 static void
-date_test_fmt(date d, char *fmt)
+date_test_fmt(date d, const char *fmt)
 {
    static int i;
    char buf[200];
index a1070e13311d8ccc3e2781eb62a338725bdfb3df..2ecf09c8374314b203921a91748ec2b42f8b4bef 100644 (file)
@@ -13,7 +13,7 @@ static void
 check_return(int ret);
 
 static void
-fmtlong(long lng, char *fmt)
+fmtlong(long lng, const char *fmt)
 {
    static int i;
    int r;
index 0386093d70bd46c7f9b0da0ea7a6597fa0987016..5380f9eb5a109e49a34be7d9c9cc761684824b8a 100644 (file)
@@ -7,7 +7,7 @@ EXEC SQL include ../regression;
 EXEC SQL DEFINE MAXDBLEN 30;
 
 /* Check SQLCODE, and produce a "standard error" if it's wrong! */
-static void sql_check(char *fn, char *caller, int ignore)
+static void sql_check(const char *fn, const char *caller, int ignore)
 {
   char errorstring[255];
 
index 87a435e9bd2c25330f805230646ab6e263e350f8..68be08276d080ffb5415cd22c14411074107e2f7 100644 (file)
@@ -24,7 +24,7 @@ static void
 check_return(int ret);
 
 static void
-date_test_strdate(char *input)
+date_test_strdate(const char *input)
 {
    static int i;
    date d;
@@ -49,7 +49,7 @@ date_test_strdate(char *input)
 }
 
 static void
-date_test_defmt(char *fmt, char *input)
+date_test_defmt(const char *fmt, const char *input)
 {
    static int i;
    char dbuf[11];
@@ -74,7 +74,7 @@ date_test_defmt(char *fmt, char *input)
 }
 
 static void
-date_test_fmt(date d, char *fmt)
+date_test_fmt(date d, const char *fmt)
 {
    static int i;
    char buf[200];
index 70e015a13013db3a7c9ce1e00ae1067364dbd1bd..b2e397e38c22c92f209d3a4c1655ec5a07c2080a 100644 (file)
@@ -24,7 +24,7 @@ static void
 check_return(int ret);
 
 static void
-fmtlong(long lng, char *fmt)
+fmtlong(long lng, const char *fmt)
 {
    static int i;
    int r;
index 4e372a5799162aed6dec848f0e5690c6117d1842..eeb9b62ab4faeab9f9de5de625424b5323f59969 100644 (file)
@@ -97,7 +97,7 @@ struct sqlca_t *ECPGget_sqlca(void);
 
 
 /* Check SQLCODE, and produce a "standard error" if it's wrong! */
-static void sql_check(char *fn, char *caller, int ignore)
+static void sql_check(const char *fn, const char *caller, int ignore)
 {
   char errorstring[255];
 
index ca23d348d6ef07e921149336c81a3fe62f63e242..b0e04731fe1dbe6b88564046cd4d061419e9d2eb 100644 (file)
@@ -114,7 +114,7 @@ static int fe(enum e x)
    return (int)x;
 }
 
-static void sqlnotice(char *notice, short trans)
+static void sqlnotice(const char *notice, short trans)
 {
    if (!notice)
        notice = "-empty-";
index 922ef76b92249747c0cf2c3621b9c37eccd3d63d..332ef85b10a165285be84c6925fae4278f0bc3d3 100644 (file)
@@ -24,7 +24,7 @@
 #line 5 "whenever.pgc"
 
 
-static void print(char *msg)
+static void print(const char *msg)
 {
         fprintf(stderr, "Error in statement '%s':\n", msg);
         sqlprint();
index 11dc01ade456b68b5602163a33000feeda3c015b..b1f71997a2ae5422a97f4b1bc243e1fc91379480 100644 (file)
@@ -35,7 +35,7 @@ static int fe(enum e x)
    return (int)x;
 }
 
-static void sqlnotice(char *notice, short trans)
+static void sqlnotice(const char *notice, short trans)
 {
    if (!notice)
        notice = "-empty-";
index 9b3ae9e9ec6c4614052131e20d993d09c3be6f25..14cf571e6ae21fc58ec2bcd6d82482efaf1d1284 100644 (file)
@@ -4,7 +4,7 @@ exec sql include ../regression;
 
 exec sql whenever sqlerror sqlprint;
 
-static void print(char *msg)
+static void print(const char *msg)
 {
         fprintf(stderr, "Error in statement '%s':\n", msg);
         sqlprint();
index ada219032ece4f8265058fc07e23b195c419f473..2c175a2a24abd8ac5d5d073f737a47123fdbe21b 100644 (file)
@@ -398,9 +398,9 @@ static int parseServiceFile(const char *serviceFile,
                 PQconninfoOption *options,
                 PQExpBuffer errorMessage,
                 bool *group_found);
-static char *pwdfMatchesString(char *buf, char *token);
-static char *passwordFromFile(char *hostname, char *port, char *dbname,
-                char *username, char *pgpassfile);
+static char *pwdfMatchesString(char *buf, const char *token);
+static char *passwordFromFile(const char *hostname, const char *port, const char *dbname,
+                const char *username, const char *pgpassfile);
 static void pgpassfileWarning(PGconn *conn);
 static void default_threadlock(int acquire);
 
@@ -6329,10 +6329,10 @@ defaultNoticeProcessor(void *arg, const char *message)
  * token doesn't match
  */
 static char *
-pwdfMatchesString(char *buf, char *token)
+pwdfMatchesString(char *buf, const char *token)
 {
-   char       *tbuf,
-              *ttok;
+   char       *tbuf;
+   const char *ttok;
    bool        bslash = false;
 
    if (buf == NULL || token == NULL)
@@ -6366,8 +6366,8 @@ pwdfMatchesString(char *buf, char *token)
 
 /* Get a password from the password file. Return value is malloc'd. */
 static char *
-passwordFromFile(char *hostname, char *port, char *dbname,
-                char *username, char *pgpassfile)
+passwordFromFile(const char *hostname, const char *port, const char *dbname,
+                const char *username, const char *pgpassfile)
 {
    FILE       *fp;
    struct stat stat_buf;
index ca0d1bccf87d792038b606ef7a05771488b88e9a..a57393fbdd9d4830daa10b4b092d0fb1784e2e41 100644 (file)
@@ -293,7 +293,7 @@ static void plperl_return_next_internal(SV *sv);
 static char *hek2cstr(HE *he);
 static SV **hv_store_string(HV *hv, const char *key, SV *val);
 static SV **hv_fetch_string(HV *hv, const char *key);
-static void plperl_create_sub(plperl_proc_desc *desc, char *s, Oid fn_oid);
+static void plperl_create_sub(plperl_proc_desc *desc, const char *s, Oid fn_oid);
 static SV  *plperl_call_perl_func(plperl_proc_desc *desc,
                      FunctionCallInfo fcinfo);
 static void plperl_compile_callback(void *arg);
@@ -2083,7 +2083,7 @@ plperlu_validator(PG_FUNCTION_ARGS)
  * supplied in s, and returns a reference to it
  */
 static void
-plperl_create_sub(plperl_proc_desc *prodesc, char *s, Oid fn_oid)
+plperl_create_sub(plperl_proc_desc *prodesc, const char *s, Oid fn_oid)
 {
    dTHX;
    dSP;
index 0156b00bfb07090549956da19a3bcb3ecbe7b1c5..e7ea3ae13828fbcfaf2b41387907db67b90aaf61 100644 (file)
@@ -438,7 +438,7 @@ string_matches_pattern(const char *str, const char *pattern)
  * NOTE: Assumes there is enough room in the target buffer!
  */
 void
-replace_string(char *string, char *replace, char *replacement)
+replace_string(char *string, const char *replace, const char *replacement)
 {
    char       *ptr;
 
@@ -460,7 +460,7 @@ replace_string(char *string, char *replace, char *replacement)
  * the given suffix.
  */
 static void
-convert_sourcefiles_in(char *source_subdir, char *dest_dir, char *dest_subdir, char *suffix)
+convert_sourcefiles_in(const char *source_subdir, const char *dest_dir, const char *dest_subdir, const char *suffix)
 {
    char        testtablespace[MAXPGPATH];
    char        indir[MAXPGPATH];
index 4abfc628e52912ad6fb57c53769da4d2d258cda6..0d9c4bfac38872df2a8406e6273ee54fdfa16921 100644 (file)
@@ -49,5 +49,5 @@ int regression_main(int argc, char *argv[],
                init_function ifunc, test_function tfunc);
 void       add_stringlist_item(_stringlist **listhead, const char *str);
 PID_TYPE   spawn_process(const char *cmdline);
-void       replace_string(char *string, char *replace, char *replacement);
+void       replace_string(char *string, const char *replace, const char *replacement);
 bool       file_exists(const char *file);