From 55e1f25da7b13d70342a7be414b3d2e64869a2cc Mon Sep 17 00:00:00 2001
From: Peter Geoghegan <pg@bowt.ie>
Date: Sat, 17 Sep 2022 15:40:08 -0700
Subject: [PATCH v3 2/6] Harmonize parameter names in timezone code.

---
 src/timezone/localtime.c | 16 +++++++++-------
 src/timezone/pgtz.c      |  8 ++++----
 src/timezone/strftime.c  | 10 +++++-----
 src/timezone/zic.c       | 34 ++++++++++++++++++----------------
 4 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c
index fa3c05903..ad83c7ee5 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 72f9e3d5e..40096ed79 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 dd6c7db86..9247a3415 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 0ea6ead2d..d6c514192 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},
-- 
2.34.1

