}
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;
*/
static metastring *
-NewMetaString(char *init_str)
+NewMetaString(const char *init_str)
{
metastring *s;
char empty_string[] = "";
static void
-MetaphAdd(metastring *s, char *new_str)
+MetaphAdd(metastring *s, const char *new_str)
{
int add_length;
/* 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);
static void *
find_provider(text *name,
PFN provider_lookup,
- char *desc, int silent)
+ const char *desc, int silent)
{
void *res;
char *buf;
* 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;
} 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);
#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',
static float
-seg_atof(char *value)
+seg_atof(const char *value)
{
Datum datum;
* Function converts UTF8-encoded file into current encoding.
*/
static TrieChar *
-initTrie(char *filename)
+initTrie(const char *filename)
{
TrieChar *volatile rootTrie = NULL;
MemoryContext ccxt = CurrentMemoryContext;
#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];
* (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;
* 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;
* 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;
* 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;
* 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;
* 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;
* and "auto" values.
*/
void
-gistValidateBufferingOption(char *value)
+gistValidateBufferingOption(const char *value)
{
if (value == NULL ||
(strcmp(value, "on") != 0 &&
* resource owner, etc while executing inside a Portal.
*/
bool
-PrepareTransactionBlock(char *gid)
+PrepareTransactionBlock(const char *gid)
{
TransactionState s;
bool result;
* This executes a SAVEPOINT command.
*/
void
-DefineSavepoint(char *name)
+DefineSavepoint(const char *name)
{
TransactionState s = CurrentTransactionState;
* the caller to do it.
*/
void
-BeginInternalSubTransaction(char *name)
+BeginInternalSubTransaction(const char *name)
{
TransactionState s = CurrentTransactionState;
* 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];
* 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;
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);
* 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)
{
* 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)
Node *raw_default,
Oid atttypid,
int32 atttypmod,
- char *attname)
+ const char *attname)
{
Node *expr;
* 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];
* 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];
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);
* 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;
static ObjectAddress
CreateExtensionInternal(char *extensionName,
char *schemaName,
- char *versionName,
- char *oldVersionName,
+ const char *versionName,
+ const char *oldVersionName,
bool cascade,
List *parents,
bool is_create)
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,
*/
bool
CheckIndexCompatible(Oid oldId,
- char *accessMethodName,
+ const char *accessMethodName,
List *attributeList,
List *exclusionOpNames)
{
List *attList, /* list of IndexElem's */
List *exclusionOpNames,
Oid relId,
- char *accessMethodName,
+ const char *accessMethodName,
Oid accessMethodId,
bool amcanorder,
bool isconstraint)
*/
Oid
ResolveOpClass(List *opclass, Oid attrType,
- char *accessMethodName, Oid accessMethodId)
+ const char *accessMethodName, Oid accessMethodId)
{
char *schemaname;
char *opcname;
* 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;
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,
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);
static void
RebuildConstraintComment(AlteredTableInfo *tab, int pass, Oid objid,
Relation rel, List *domname,
- char *conname)
+ const char *conname)
{
CommentStmt *cmd;
char *comment_str;
* 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;
* 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);
* 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);
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);
* Implements the ALTER DOMAIN .. VALIDATE CONSTRAINT statement.
*/
ObjectAddress
-AlterDomainValidateConstraint(List *names, char *constrName)
+AlterDomainValidateConstraint(List *names, const char *constrName)
{
TypeName *typename;
Oid domainoid;
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;
* are "local" and "cascaded".
*/
void
-validateWithCheckOption(char *value)
+validateWithCheckOption(const char *value)
{
if (value == NULL ||
(pg_strcasecmp(value, "local") != 0 &&
* 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);
#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);
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 */
*----------------------------------------------------------------
*/
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);
/*
* 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;
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,
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;
* 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;
}
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;
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
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);
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 ||
* 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;
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);
* 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;
* 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)
{
* 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;
* 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;
*/
void
errorMissingColumn(ParseState *pstate,
- char *relname, char *colname, int location)
+ const char *relname, const char *colname, int location)
{
FuzzyAttrMatchState *state;
char *closestfirst = NULL;
transformAssignedExpr(ParseState *pstate,
Expr *expr,
ParseExprKind exprKind,
- char *colname,
+ const char *colname,
int attrno,
List *indirection,
int location)
#ifdef HAVE_DLOPEN
void *
-pg_dlopen(char *filename)
+pg_dlopen(const char *filename)
{
return dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
}
}
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);
static NSObjectFileImageReturnCode cofiff_result = NSObjectFileImageFailure;
void *
-pg_dlopen(char *filename)
+pg_dlopen(const char *filename)
{
NSObjectFileImage image;
}
PGFunction
-pg_dlsym(void *handle, char *funcname)
+pg_dlsym(void *handle, const char *funcname)
{
NSSymbol symbol;
char *symname = (char *) malloc(strlen(funcname) + 2);
#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);
#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
}
PGFunction
-pg_dlsym(void *handle, char *funcname)
+pg_dlsym(void *handle, const char *funcname)
{
PGFunction f;
/* 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);
#ifndef HAVE_DLOPEN
void *
-pg_dlopen(char *filename)
+pg_dlopen(const char *filename)
{
#ifndef HAVE_DLD_H
elog(ERROR, "dynamic load not supported");
}
PGFunction
-pg_dlsym(void *handle, char *funcname)
+pg_dlsym(void *handle, const char *funcname)
{
#ifndef HAVE_DLD_H
return NULL;
* Connect background worker to a database.
*/
void
-BackgroundWorkerInitializeConnection(char *dbname, char *username)
+BackgroundWorkerInitializeConnection(const char *dbname, const char *username)
{
BackgroundWorker *worker = MyBgworkerEntry;
} 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,
* 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;
* 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;
* relation "pg_rewrite"
*/
static Oid
-InsertRule(char *rulname,
+InsertRule(const char *rulname,
int evtype,
Oid eventrel_oid,
bool evinstead,
* 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,
static void
-locate_stem_module(DictSnowball *d, char *lang)
+locate_stem_module(DictSnowball *d, const char *lang)
{
const stemmer_module *m;
* 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) \
if (LWLockTrancheArray == NULL)
{
LWLockTranchesAllocated = 128;
- LWLockTrancheArray = (char **)
+ LWLockTrancheArray = (const char **)
MemoryContextAllocZero(TopMemoryContext,
LWLockTranchesAllocated * sizeof(char *));
Assert(LWLockTranchesAllocated >= LWTRANCHE_FIRST_USER_DEFINED);
* (TopMemoryContext, static variable, or similar).
*/
void
-LWLockRegisterTranche(int tranche_id, char *tranche_name)
+LWLockRegisterTranche(int tranche_id, const char *tranche_name)
{
Assert(LWLockTrancheArray != NULL);
while (i <= tranche_id)
i *= 2;
- LWLockTrancheArray = (char **)
+ LWLockTrancheArray = (const char **)
repalloc(LWLockTrancheArray, i * sizeof(char *));
LWLockTranchesAllocated = i;
while (j < LWLockTranchesAllocated)
#define TR_INSUBS 4
static void
-thesaurusRead(char *filename, DictThesaurus *d)
+thesaurusRead(const char *filename, DictThesaurus *d)
{
tsearch_readline_state trst;
uint32 idsubst = 0;
* 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];
* 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,
/* 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;
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);
* 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;
* 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;
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,
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);
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;
/* Ditto, except input is char* */
static xmlChar *
-pg_xmlCharStrndup(char *str, size_t len)
+pg_xmlCharStrndup(const char *str, size_t len)
{
xmlChar *result;
* 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 */
* 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
* 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);
* 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;
* 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;
* Install the row-filter Xpath expression.
*/
static void
-XmlTableSetRowFilter(TableFuncScanState *state, char *path)
+XmlTableSetRowFilter(TableFuncScanState *state, const char *path)
{
#ifdef USE_LIBXML
XmlTableBuilderData *xtCxt;
* 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;
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);
* 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;
* 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);
}
* if extrapath is not NULL
*/
static void
-write_version_file(char *extrapath)
+write_version_file(const char *extrapath)
{
FILE *version_file;
char *path;
* 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;
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);
* 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);
* 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 */
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"
*/
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)
{
* 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];
* 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];
* wal segment size.
*/
static bool
-search_directory(char *directory, char *fname)
+search_directory(const char *directory, const char *fname)
{
int fd = -1;
DIR *xldir;
}
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",
}
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;
/* 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,
} 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
{
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,
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);
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);
Node *raw_default,
Oid atttypid,
int32 atttypmod,
- char *attname);
+ const char *attname);
extern void DeleteRelationTuple(Oid relid);
extern void DeleteAttributeTuples(Oid relid);
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);
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);
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);
#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);
{
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);
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);
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);
char *colname, bool resjunk);
extern Expr *transformAssignedExpr(ParseState *pstate, Expr *expr,
ParseExprKind exprKind,
- char *colname,
+ const char *colname,
int attrno,
List *indirection,
int location);
* 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);
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,
* 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);
/*
#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);
#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,
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 */
}
int
-deccvasc(char *cp, int len, decimal *np)
+deccvasc(const char *cp, int len, decimal *np)
{
char *str;
int ret = 0;
*
*/
int
-rstrdate(char *str, date * d)
+rstrdate(const char *str, date * d)
{
return rdefmtdate(d, "mm/dd/yyyy", str);
}
}
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 */
}
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)
/* 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,
/* 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;
}
int
-risnull(int t, char *ptr)
+risnull(int t, const char *ptr)
{
return ECPGis_noind_null(t, 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)
}
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 */
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:
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);
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 *);
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);
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
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);
#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
/* 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;
/* 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 == '-')
}
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,
/* 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 =
};
/* 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 *);
check_return(int ret);
static void
-date_test_strdate(char *input)
+date_test_strdate(const char *input)
{
static int i;
date d;
}
static void
-date_test_defmt(char *fmt, char *input)
+date_test_defmt(const char *fmt, const char *input)
{
static int i;
char dbuf[11];
}
static void
-date_test_fmt(date d, char *fmt)
+date_test_fmt(date d, const char *fmt)
{
static int i;
char buf[200];
check_return(int ret);
static void
-fmtlong(long lng, char *fmt)
+fmtlong(long lng, const char *fmt)
{
static int i;
int r;
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];
check_return(int ret);
static void
-date_test_strdate(char *input)
+date_test_strdate(const char *input)
{
static int i;
date d;
}
static void
-date_test_defmt(char *fmt, char *input)
+date_test_defmt(const char *fmt, const char *input)
{
static int i;
char dbuf[11];
}
static void
-date_test_fmt(date d, char *fmt)
+date_test_fmt(date d, const char *fmt)
{
static int i;
char buf[200];
check_return(int ret);
static void
-fmtlong(long lng, char *fmt)
+fmtlong(long lng, const char *fmt)
{
static int i;
int r;
/* 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];
return (int)x;
}
-static void sqlnotice(char *notice, short trans)
+static void sqlnotice(const char *notice, short trans)
{
if (!notice)
notice = "-empty-";
#line 5 "whenever.pgc"
-static void print(char *msg)
+static void print(const char *msg)
{
fprintf(stderr, "Error in statement '%s':\n", msg);
sqlprint();
return (int)x;
}
-static void sqlnotice(char *notice, short trans)
+static void sqlnotice(const char *notice, short trans)
{
if (!notice)
notice = "-empty-";
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();
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);
* 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)
/* 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;
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);
* 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;
* 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;
* 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];
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);