mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Add some const decorations to prototypes
Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
This commit is contained in:
		@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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 *);
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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 == '-')
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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 =
 | 
			
		||||
 
 | 
			
		||||
@@ -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 *);
 | 
			
		||||
 
 | 
			
		||||
@@ -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];
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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];
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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-";
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
@@ -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-";
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user