1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Add some const decorations to prototypes

Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
This commit is contained in:
Peter Eisentraut
2017-10-31 10:34:31 -04:00
parent 7e60e67861
commit 0e1539ba0d
95 changed files with 236 additions and 236 deletions

View 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;

View 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 &&

View 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;

View 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;

View 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;

View 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];

View 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;

View 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)

View 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;

View 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;

View 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);

View 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;

View 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 &&

View 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

View 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 ||

View 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;

View 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;

View 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;

View File

@ -455,7 +455,7 @@ Expr *
transformAssignedExpr(ParseState *pstate,
Expr *expr,
ParseExprKind exprKind,
char *colname,
const char *colname,
int attrno,
List *indirection,
int location)

View 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);

View 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);

View 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;

View 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);

View 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;

View 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;

View 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;

View 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,

View 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;

View 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)

View 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;

View 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,

View 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;

View 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;

View 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;

View 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;