]> granicus.if.org Git - postgresql/commitdiff
Mark variables as const in pgtypeslib if they only carry a format string.
authorMichael Meskes <meskes@postgresql.org>
Sun, 18 Dec 2011 18:04:19 +0000 (19:04 +0100)
committerMichael Meskes <meskes@postgresql.org>
Sun, 18 Dec 2011 18:04:19 +0000 (19:04 +0100)
src/interfaces/ecpg/include/pgtypes_date.h
src/interfaces/ecpg/include/pgtypes_timestamp.h
src/interfaces/ecpg/pgtypeslib/common.c
src/interfaces/ecpg/pgtypeslib/datetime.c
src/interfaces/ecpg/pgtypeslib/extern.h
src/interfaces/ecpg/pgtypeslib/timestamp.c

index 7ab8046b7b10e941295ce7ce018af8240b3c8bf4..b8990bb07230f2acf6f8ea33f480d96ac5d6b8db 100644 (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
 }
index 07e95294b3e39c5fc90b5e84a79da590fdafbff2..537585ce21563a6dc8e3ed70f62ac827ad030456 100644 (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);
 
index d800321a9d394acc81e74122536380875358a3f3..9084fd06b4e051c93d816f903b900a538465200d 100644 (file)
@@ -16,7 +16,7 @@ pgtypes_alloc(long size)
 }
 
 char *
-pgtypes_strdup(char *str)
+pgtypes_strdup(const char *str)
 {
        char       *new = (char *) strdup(str);
 
index 41377a68611635dd8224be2e6ff7a16085f6c8dc..823626fcf56b5111b713812990535949802f9796 100644 (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
index c7c64b15782fc783a1c22062fabbfbb91d174ebf..88b2fb0775942d7bfd28fb58aeb621fc053db4b8 100644 (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
index 8d787bbbe61607f8ff4a64b932257f51bccce952..dc5ff72b601715ec40c2bb460d3ac3288a16bd2d 100644 (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,