summaryrefslogtreecommitdiff
path: root/src/timezone
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2022-09-19 15:13:42 -0700
committerPeter Geoghegan <pg@bowt.ie>2022-09-19 15:13:42 -0700
commitc4f8e89fef3d4cd8b0791637667fd984d6f38fb2 (patch)
tree4f64968ab17baef3aa658c963d2a215598ee3eb1 /src/timezone
parentbc2187ed63c56bb9cd99f6613f3e2ba56afb22fe (diff)
downloadpostgresql-c4f8e89fef3d4cd8b0791637667fd984d6f38fb2.tar.gz
Consistently use named parameters in timezone code.
Make our copy of the IANA timezone library use named parameters in function declarations. Also make sure that parameter names from each function's declaration match corresponding definition parameter names. This makes the timezone code follow Postgres coding standards. The value of having a consistent standard everywhere seems to outweigh the cost of keeping the function declarations in sync with future IANA releases. Author: Peter Geoghegan <pg@bowt.ie> Reviewed-By: David Rowley <dgrowleyml@gmail.com> Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
Diffstat (limited to 'src/timezone')
-rw-r--r--src/timezone/localtime.c16
-rw-r--r--src/timezone/pgtz.c8
-rw-r--r--src/timezone/strftime.c10
-rw-r--r--src/timezone/zic.c34
4 files changed, 36 insertions, 32 deletions
diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c
index fa3c059038..ad83c7ee5e 100644
--- a/src/timezone/localtime.c
+++ b/src/timezone/localtime.c
@@ -82,13 +82,15 @@ struct rule
* Prototypes for static functions.
*/
-static struct pg_tm *gmtsub(pg_time_t const *, int32, struct pg_tm *);
-static bool increment_overflow(int *, int);
-static bool increment_overflow_time(pg_time_t *, int32);
-static int64 leapcorr(struct state const *, pg_time_t);
-static struct pg_tm *timesub(pg_time_t const *, int32, struct state const *,
- struct pg_tm *);
-static bool typesequiv(struct state const *, int, int);
+static struct pg_tm *gmtsub(pg_time_t const *timep, int32 offset,
+ struct pg_tm *tmp);
+static bool increment_overflow(int *ip, int j);
+static bool increment_overflow_time(pg_time_t *tp, int32 j);
+static int64 leapcorr(struct state const *sp, pg_time_t t);
+static struct pg_tm *timesub(pg_time_t const *timep,
+ int32 offset, struct state const *sp,
+ struct pg_tm *tmp);
+static bool typesequiv(struct state const *sp, int a, int b);
/*
diff --git a/src/timezone/pgtz.c b/src/timezone/pgtz.c
index 72f9e3d5e6..40096ed792 100644
--- a/src/timezone/pgtz.c
+++ b/src/timezone/pgtz.c
@@ -232,7 +232,7 @@ init_timezone_hashtable(void)
* default timezone setting is later overridden from postgresql.conf.
*/
pg_tz *
-pg_tzset(const char *name)
+pg_tzset(const char *tzname)
{
pg_tz_cache *tzp;
struct state tzstate;
@@ -240,7 +240,7 @@ pg_tzset(const char *name)
char canonname[TZ_STRLEN_MAX + 1];
char *p;
- if (strlen(name) > TZ_STRLEN_MAX)
+ if (strlen(tzname) > TZ_STRLEN_MAX)
return NULL; /* not going to fit */
if (!timezone_cache)
@@ -254,8 +254,8 @@ pg_tzset(const char *name)
* a POSIX-style timezone spec.)
*/
p = uppername;
- while (*name)
- *p++ = pg_toupper((unsigned char) *name++);
+ while (*tzname)
+ *p++ = pg_toupper((unsigned char) *tzname++);
*p = '\0';
tzp = (pg_tz_cache *) hash_search(timezone_cache,
diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c
index dd6c7db869..9247a34157 100644
--- a/src/timezone/strftime.c
+++ b/src/timezone/strftime.c
@@ -111,11 +111,11 @@ enum warn
IN_NONE, IN_SOME, IN_THIS, IN_ALL
};
-static char *_add(const char *, char *, const char *);
-static char *_conv(int, const char *, char *, const char *);
-static char *_fmt(const char *, const struct pg_tm *, char *, const char *,
- enum warn *);
-static char *_yconv(int, int, bool, bool, char *, char const *);
+static char *_add(const char *str, char *pt, const char *ptlim);
+static char *_conv(int n, const char *format, char *pt, const char *ptlim);
+static char *_fmt(const char *format, const struct pg_tm *t, char *pt, const char *ptlim,
+ enum warn *warnp);
+static char *_yconv(int a, int b, bool convert_top, bool convert_yy, char *pt, char const *ptlim);
/*
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index 0ea6ead2db..d6c5141923 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -123,30 +123,32 @@ static void error(const char *string,...) pg_attribute_printf(1, 2);
static void warning(const char *string,...) pg_attribute_printf(1, 2);
static void usage(FILE *stream, int status) pg_attribute_noreturn();
static void addtt(zic_t starttime, int type);
-static int addtype(zic_t, char const *, bool, bool, bool);
-static void leapadd(zic_t, int, int);
+static int addtype(zic_t utoff, char const *abbr,
+ bool isdst, bool ttisstd, bool ttisut);
+static void leapadd(zic_t t, int correction, int rolling);
static void adjleap(void);
static void associate(void);
-static void dolink(const char *, const char *, bool);
-static char **getfields(char *buf);
+static void dolink(char const *target, char const *linkname,
+ bool staysymlink);
+static char **getfields(char *cp);
static zic_t gethms(const char *string, const char *errstring);
-static zic_t getsave(char *, bool *);
-static void inexpires(char **, int);
-static void infile(const char *filename);
+static zic_t getsave(char *field, bool *isdst);
+static void inexpires(char **fields, int nfields);
+static void infile(const char *name);
static void inleap(char **fields, int nfields);
static void inlink(char **fields, int nfields);
static void inrule(char **fields, int nfields);
static bool inzcont(char **fields, int nfields);
static bool inzone(char **fields, int nfields);
-static bool inzsub(char **, int, bool);
-static bool itsdir(char const *);
-static bool itssymlink(char const *);
+static bool inzsub(char **fields, int nfields, bool iscont);
+static bool itsdir(char const *name);
+static bool itssymlink(char const *name);
static bool is_alpha(char a);
-static char lowerit(char);
-static void mkdirs(char const *, bool);
-static void newabbr(const char *abbr);
+static char lowerit(char a);
+static void mkdirs(char const *argname, bool ancestors);
+static void newabbr(const char *string);
static zic_t oadd(zic_t t1, zic_t t2);
-static void outzone(const struct zone *zp, ptrdiff_t ntzones);
+static void outzone(const struct zone *zpfirst, ptrdiff_t zonecount);
static zic_t rpytime(const struct rule *rp, zic_t wantedy);
static void rulesub(struct rule *rp,
const char *loyearp, const char *hiyearp,
@@ -304,8 +306,8 @@ struct lookup
const int l_value;
};
-static struct lookup const *byword(const char *string,
- const struct lookup *lp);
+static struct lookup const *byword(const char *word,
+ const struct lookup *table);
static struct lookup const zi_line_codes[] = {
{"Rule", LC_RULE},