Mark variables as const in pgtypeslib if they only carry a format string.

This commit is contained in:
Michael Meskes 2011-12-18 19:04:19 +01:00
parent 22232834c5
commit 59e242a496
6 changed files with 13 additions and 13 deletions

View File

@ -21,8 +21,8 @@ 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 *, char *, char *);
extern int PGTYPESdate_fmt_asc(date, char *, char *);
extern int PGTYPESdate_defmt_asc(date *, const char *, char *);
extern int PGTYPESdate_fmt_asc(date, const char *, char *);
#ifdef __cplusplus
}

View File

@ -22,9 +22,9 @@ extern "C"
extern timestamp PGTYPEStimestamp_from_asc(char *, char **);
extern char *PGTYPEStimestamp_to_asc(timestamp);
extern int PGTYPEStimestamp_sub(timestamp *, timestamp *, interval *);
extern int PGTYPEStimestamp_fmt_asc(timestamp *, char *, int, char *);
extern int PGTYPEStimestamp_fmt_asc(timestamp *, char *, int, const char *);
extern void PGTYPEStimestamp_current(timestamp *);
extern int PGTYPEStimestamp_defmt_asc(char *, char *, timestamp *);
extern int PGTYPEStimestamp_defmt_asc(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);

View File

@ -16,7 +16,7 @@ pgtypes_alloc(long size)
}
char *
pgtypes_strdup(char *str)
pgtypes_strdup(const char *str)
{
char *new = (char *) strdup(str);

View File

@ -173,7 +173,7 @@ PGTYPESdate_today(date * d)
#define PGTYPES_FMTDATE_YEAR_DIGITS_LONG 6
int
PGTYPESdate_fmt_asc(date dDate, char *fmtstring, char *outbuf)
PGTYPESdate_fmt_asc(date dDate, const char *fmtstring, char *outbuf)
{
static struct
{
@ -335,7 +335,7 @@ PGTYPESdate_fmt_asc(date dDate, char *fmtstring, char *outbuf)
#define PGTYPES_DATE_MONTH_MAXLENGTH 20 /* probably even less :-) */
int
PGTYPESdate_defmt_asc(date * d, char *fmt, char *str)
PGTYPESdate_defmt_asc(date * d, const char *fmt, char *str)
{
/*
* token[2] = { 4,6 } means that token 2 starts at position 4 and ends at

View File

@ -37,7 +37,7 @@ union un_fmt_comb
int pgtypes_fmt_replace(union un_fmt_comb, int, char **, int *);
char *pgtypes_alloc(long);
char *pgtypes_strdup(char *);
char *pgtypes_strdup(const char *);
#ifndef bool
#define bool char

View File

@ -18,7 +18,7 @@
#include "pgtypes_date.h"
int PGTYPEStimestamp_defmt_scan(char **, char *, timestamp *, int *, int *, int *,
int PGTYPEStimestamp_defmt_scan(char **, const char *, timestamp *, int *, int *, int *,
int *, int *, int *, int *);
#ifdef HAVE_INT64_TIMESTAMP
@ -384,12 +384,12 @@ PGTYPEStimestamp_current(timestamp * ts)
static int
dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
char *output, int *pstr_len, char *fmtstr)
char *output, int *pstr_len, const char *fmtstr)
{
union un_fmt_comb replace_val;
int replace_type;
int i;
char *p = fmtstr;
const char *p = fmtstr;
char *q = output;
while (*p)
@ -866,7 +866,7 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm,
int
PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, char *fmtstr)
PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, const char *fmtstr)
{
struct tm tm;
fsec_t fsec;
@ -894,7 +894,7 @@ PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv)
}
int
PGTYPEStimestamp_defmt_asc(char *str, char *fmt, timestamp * d)
PGTYPEStimestamp_defmt_asc(char *str, const char *fmt, timestamp * d)
{
int year,
month,