[tz] [PROPOSED PATCH] * date.c, localtime.c, zdump.c: Simplify prototypes for static functions
Paul Eggert
eggert at cs.ucla.edu
Sat Aug 16 06:47:41 UTC 2014
by removing prototypes that aren't needed, and by removing names
of argumnts. This will make future changes simpler and easier to
follow.
---
date.c | 2 --
localtime.c | 69 +++++++++++--------------------------------------------------
zdump.c | 15 +++++++-------
3 files changed, 19 insertions(+), 67 deletions(-)
diff --git a/date.c b/date.c
index 3d78914..de56652 100644
--- a/date.c
+++ b/date.c
@@ -60,11 +60,9 @@ static void display(const char *, time_t);
static void dogmt(void);
static void errensure(void);
static void iffy(time_t, time_t, const char *, const char *);
-int main(int, char**);
static const char * nondigit(const char *);
static void oops(const char *);
static void reset(time_t, int);
-static int sametm(const struct tm *, const struct tm *);
static void timeout(FILE *, const char *, const struct tm *);
static void usage(void);
static void wildinput(const char *, const char *,
diff --git a/localtime.c b/localtime.c
index e2cf5c2..840fa21 100644
--- a/localtime.c
+++ b/localtime.c
@@ -126,59 +126,14 @@ struct rule {
#define DAY_OF_YEAR 1 /* n = day of year */
#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d = month, week, day of week */
-/*
-** Prototypes for static functions.
-*/
-
-static int_fast32_t detzcode(const char * codep);
-static int_fast64_t detzcode64(const char * codep);
-static int differ_by_repeat(time_t t1, time_t t0);
-static const char * getzname(const char * strp) ATTRIBUTE_PURE;
-static const char * getqzname(const char * strp, const int delim)
- ATTRIBUTE_PURE;
-static const char * getnum(const char * strp, int * nump, int min,
- int max);
-static const char * getsecs(const char * strp, int_fast32_t * secsp);
-static const char * getoffset(const char * strp, int_fast32_t * offsetp);
-static const char * getrule(const char * strp, struct rule * rulep);
-static void gmtload(struct state * sp);
-static struct tm * gmtsub(const time_t * timep, int_fast32_t offset,
- struct tm * tmp);
-static struct tm * localsub(const time_t * timep, int_fast32_t offset,
- struct tm * tmp);
-static int increment_overflow(int * number, int delta);
-static int leaps_thru_end_of(int y) ATTRIBUTE_PURE;
-static int increment_overflow32(int_fast32_t * number, int delta);
-static int increment_overflow_time(time_t *t, int_fast32_t delta);
-static int normalize_overflow32(int_fast32_t * tensptr,
- int * unitsptr, int base);
-static int normalize_overflow(int * tensptr, int * unitsptr,
- int base);
-static void settzname(void);
-static time_t time1(struct tm * tmp,
- struct tm * (*funcp)(const time_t *,
- int_fast32_t, struct tm *),
- int_fast32_t offset);
-static time_t time2(struct tm *tmp,
- struct tm * (*funcp)(const time_t *,
- int_fast32_t, struct tm*),
- int_fast32_t offset, int * okayp);
-static time_t time2sub(struct tm *tmp,
- struct tm * (*funcp)(const time_t *,
- int_fast32_t, struct tm*),
- int_fast32_t offset, int * okayp, int do_norm_secs);
-static struct tm * timesub(const time_t * timep, int_fast32_t offset,
- const struct state * sp, struct tm * tmp);
-static int tmcomp(const struct tm * atmp,
- const struct tm * btmp);
-static int_fast32_t transtime(int year, const struct rule * rulep,
- int_fast32_t offset)
- ATTRIBUTE_PURE;
-static int typesequiv(const struct state * sp, int a, int b);
-static int tzload(const char * name, struct state * sp,
- int doextend);
-static int tzparse(const char * name, struct state * sp,
- int lastditch);
+static struct tm *gmtsub(time_t const *, int_fast32_t, struct tm *);
+static int increment_overflow(int *, int);
+static int increment_overflow_time(time_t *, int_fast32_t);
+static int normalize_overflow32(int_fast32_t *, int *, int);
+static struct tm *timesub(time_t const *, int_fast32_t, struct state const *,
+ struct tm *);
+static int typesequiv(struct state const *, int, int);
+static int tzparse(char const *, struct state *, int);
#ifdef ALL_STATE
static struct state * lclptr;
@@ -657,7 +612,7 @@ static const int year_lengths[2] = {
** character.
*/
-static const char *
+static const char * ATTRIBUTE_PURE
getzname(register const char *strp)
{
register char c;
@@ -677,7 +632,7 @@ getzname(register const char *strp)
** We don't do any checking here; checking is done later in common-case code.
*/
-static const char *
+static const char * ATTRIBUTE_PURE
getqzname(register const char *strp, const int delim)
{
register int c;
@@ -839,7 +794,7 @@ getrule(const char *strp, register struct rule *const rulep)
** effect, calculate the year-relative time that rule takes effect.
*/
-static int_fast32_t
+static int_fast32_t ATTRIBUTE_PURE
transtime(const int year, register const struct rule *const rulep,
const int_fast32_t offset)
{
@@ -1419,7 +1374,7 @@ offtime(const time_t *const timep, const long offset)
** where, to make the math easy, the answer for year zero is defined as zero.
*/
-static int
+static int ATTRIBUTE_PURE
leaps_thru_end_of(register const int y)
{
return (y >= 0) ? (y / 4 - y / 100 + y / 400) :
diff --git a/zdump.c b/zdump.c
index 859a169..515a80f 100644
--- a/zdump.c
+++ b/zdump.c
@@ -207,14 +207,13 @@ static size_t longest;
static char * progname;
static int warned;
-static char * abbr(struct tm * tmp);
-static void abbrok(const char * abbrp, const char * zone);
-static intmax_t delta(struct tm * newp, struct tm * oldp) ATTRIBUTE_PURE;
-static void dumptime(const struct tm * tmp);
-static time_t hunt(char * name, time_t lot, time_t hit);
-static void show(char * zone, time_t t, int v);
-static const char * tformat(void);
-static time_t yeartot(intmax_t y) ATTRIBUTE_PURE;
+static char *abbr(struct tm *);
+static intmax_t delta(struct tm *, struct tm *) ATTRIBUTE_PURE;
+static void dumptime(struct tm const *);
+static time_t hunt(char *, time_t, time_t);
+static void show(char *, time_t, int);
+static const char *tformat(void);
+static time_t yeartot(intmax_t) ATTRIBUTE_PURE;
/* Is A an alphabetic character in the C locale? */
static int
--
1.9.1
More information about the tz
mailing list