提交 0b62bbe0 编写于 作者: N Neil Conway

Cosmetic improvements to the timezone code: remove the use of the

'register' qualifier, make some function declarations more consistent,
and so on.
上级 ec490f51
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). * 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/ialloc.c,v 1.5 2004/05/21 20:59:10 tgl Exp $ * $PostgreSQL: pgsql/src/timezone/ialloc.c,v 1.6 2005/06/20 08:00:51 neilc Exp $
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -38,9 +38,9 @@ irealloc(void *pointer, const int size) ...@@ -38,9 +38,9 @@ irealloc(void *pointer, const int size)
char * char *
icatalloc(char *old, const char *new) icatalloc(char *old, const char *new)
{ {
register char *result; char *result;
register int oldsize, int oldsize,
newsize; newsize;
newsize = (new == NULL) ? 0 : strlen(new); newsize = (new == NULL) ? 0 : strlen(new);
if (old == NULL) if (old == NULL)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). * 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.10 2005/04/19 03:13:59 momjian Exp $ * $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.11 2005/06/20 08:00:51 neilc Exp $
*/ */
/* /*
...@@ -81,15 +81,15 @@ static const char *getzname(const char *strp); ...@@ -81,15 +81,15 @@ static const char *getzname(const char *strp);
static const char *getnum(const char *strp, int *nump, int min, int max); static const char *getnum(const char *strp, int *nump, int min, int max);
static const char *getsecs(const char *strp, long *secsp); static const char *getsecs(const char *strp, long *secsp);
static const char *getoffset(const char *strp, long *offsetp); static const char *getoffset(const char *strp, long *offsetp);
static const char *getrule(const char *strp, struct rule * rulep); static const char *getrule(const char *strp, struct rule *rulep);
static void gmtload(struct state * sp); static void gmtload(struct state *sp);
static void gmtsub(const pg_time_t *timep, long offset, struct pg_tm * tmp); static void gmtsub(const pg_time_t *timep, long offset, struct pg_tm *tmp);
static void localsub(const pg_time_t *timep, long offset, struct pg_tm * tmp, const pg_tz *tz); static void localsub(const pg_time_t *timep, long offset, struct pg_tm *tmp, const pg_tz *tz);
static void timesub(const pg_time_t *timep, long offset, static void timesub(const pg_time_t *timep, long offset,
const struct state * sp, struct pg_tm * tmp); const struct state *sp, struct pg_tm *tmp);
static pg_time_t transtime(pg_time_t janfirst, int year, static pg_time_t transtime(pg_time_t janfirst, int year,
const struct rule * rulep, long offset); const struct rule *rulep, long offset);
int tzparse(const char *name, struct state * sp, int lastditch); int tzparse(const char *name, struct state *sp, int lastditch);
/* GMT timezone */ /* GMT timezone */
static struct state gmtmem; static struct state gmtmem;
...@@ -113,8 +113,8 @@ static struct pg_tm tm; ...@@ -113,8 +113,8 @@ static struct pg_tm tm;
static long static long
detzcode(const char *codep) detzcode(const char *codep)
{ {
register long result; long result;
register int i; int i;
result = (codep[0] & 0x80) ? ~0L : 0L; result = (codep[0] & 0x80) ? ~0L : 0L;
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
...@@ -123,16 +123,16 @@ detzcode(const char *codep) ...@@ -123,16 +123,16 @@ detzcode(const char *codep)
} }
int int
tzload(register const char *name, register struct state * sp) tzload(const char *name, struct state *sp)
{ {
register const char *p; const char *p;
register int i; int i;
register int fid; int fid;
if (name == NULL && (name = TZDEFAULT) == NULL) if (name == NULL && (name = TZDEFAULT) == NULL)
return -1; return -1;
{ {
register int doaccess; int doaccess;
char fullname[MAXPGPATH]; char fullname[MAXPGPATH];
if (name[0] == ':') if (name[0] == ':')
...@@ -209,7 +209,7 @@ tzload(register const char *name, register struct state * sp) ...@@ -209,7 +209,7 @@ tzload(register const char *name, register struct state * sp)
} }
for (i = 0; i < sp->typecnt; ++i) for (i = 0; i < sp->typecnt; ++i)
{ {
register struct ttinfo *ttisp; struct ttinfo *ttisp;
ttisp = &sp->ttis[i]; ttisp = &sp->ttis[i];
ttisp->tt_gmtoff = detzcode(p); ttisp->tt_gmtoff = detzcode(p);
...@@ -227,7 +227,7 @@ tzload(register const char *name, register struct state * sp) ...@@ -227,7 +227,7 @@ tzload(register const char *name, register struct state * sp)
sp->chars[i] = '\0'; /* ensure '\0' at end */ sp->chars[i] = '\0'; /* ensure '\0' at end */
for (i = 0; i < sp->leapcnt; ++i) for (i = 0; i < sp->leapcnt; ++i)
{ {
register struct lsinfo *lsisp; struct lsinfo *lsisp;
lsisp = &sp->lsis[i]; lsisp = &sp->lsis[i];
lsisp->ls_trans = detzcode(p); lsisp->ls_trans = detzcode(p);
...@@ -237,7 +237,7 @@ tzload(register const char *name, register struct state * sp) ...@@ -237,7 +237,7 @@ tzload(register const char *name, register struct state * sp)
} }
for (i = 0; i < sp->typecnt; ++i) for (i = 0; i < sp->typecnt; ++i)
{ {
register struct ttinfo *ttisp; struct ttinfo *ttisp;
ttisp = &sp->ttis[i]; ttisp = &sp->ttis[i];
if (ttisstdcnt == 0) if (ttisstdcnt == 0)
...@@ -252,7 +252,7 @@ tzload(register const char *name, register struct state * sp) ...@@ -252,7 +252,7 @@ tzload(register const char *name, register struct state * sp)
} }
for (i = 0; i < sp->typecnt; ++i) for (i = 0; i < sp->typecnt; ++i)
{ {
register struct ttinfo *ttisp; struct ttinfo *ttisp;
ttisp = &sp->ttis[i]; ttisp = &sp->ttis[i];
if (ttisgmtcnt == 0) if (ttisgmtcnt == 0)
...@@ -284,9 +284,9 @@ static const int year_lengths[2] = { ...@@ -284,9 +284,9 @@ static const int year_lengths[2] = {
* character. * character.
*/ */
static const char * static const char *
getzname(register const char *strp) getzname(const char *strp)
{ {
register char c; char c;
while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' && while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
c != '+') c != '+')
...@@ -301,10 +301,10 @@ getzname(register const char *strp) ...@@ -301,10 +301,10 @@ getzname(register const char *strp)
* Otherwise, return a pointer to the first character not part of the number. * Otherwise, return a pointer to the first character not part of the number.
*/ */
static const char * static const char *
getnum(register const char *strp, int *nump, const int min, const int max) getnum(const char *strp, int *nump, int min, int max)
{ {
register char c; char c;
register int num; int num;
if (strp == NULL || !is_digit(c = *strp)) if (strp == NULL || !is_digit(c = *strp))
return NULL; return NULL;
...@@ -330,7 +330,7 @@ getnum(register const char *strp, int *nump, const int min, const int max) ...@@ -330,7 +330,7 @@ getnum(register const char *strp, int *nump, const int min, const int max)
* of seconds. * of seconds.
*/ */
static const char * static const char *
getsecs(register const char *strp, long *secsp) getsecs(const char *strp, long *secsp)
{ {
int num; int num;
...@@ -370,9 +370,9 @@ getsecs(register const char *strp, long *secsp) ...@@ -370,9 +370,9 @@ getsecs(register const char *strp, long *secsp)
* Otherwise, return a pointer to the first character not part of the time. * Otherwise, return a pointer to the first character not part of the time.
*/ */
static const char * static const char *
getoffset(register const char *strp, long *offsetp) getoffset(const char *strp, long *offsetp)
{ {
register int neg = 0; int neg = 0;
if (*strp == '-') if (*strp == '-')
{ {
...@@ -396,7 +396,7 @@ getoffset(register const char *strp, long *offsetp) ...@@ -396,7 +396,7 @@ getoffset(register const char *strp, long *offsetp)
* Otherwise, return a pointer to the first character not part of the rule. * Otherwise, return a pointer to the first character not part of the rule.
*/ */
static const char * static const char *
getrule(const char *strp, register struct rule * rulep) getrule(const char *strp, struct rule *rulep)
{ {
if (*strp == 'J') if (*strp == 'J')
{ {
...@@ -457,13 +457,13 @@ getrule(const char *strp, register struct rule * rulep) ...@@ -457,13 +457,13 @@ getrule(const char *strp, register struct rule * rulep)
* calculate the Epoch-relative time that rule takes effect. * calculate the Epoch-relative time that rule takes effect.
*/ */
static pg_time_t static pg_time_t
transtime(const pg_time_t janfirst, const int year, transtime(const pg_time_t janfirst, int year,
register const struct rule * rulep, const long offset) const struct rule *rulep, long offset)
{ {
register int leapyear; int leapyear;
register pg_time_t value = 0; pg_time_t value = 0;
register int i; int i,
int d, d,
m1, m1,
yy0, yy0,
yy1, yy1,
...@@ -556,7 +556,7 @@ transtime(const pg_time_t janfirst, const int year, ...@@ -556,7 +556,7 @@ transtime(const pg_time_t janfirst, const int year,
*/ */
int int
tzparse(const char *name, register struct state * sp, const int lastditch) tzparse(const char *name, struct state *sp, int lastditch)
{ {
const char *stdname; const char *stdname;
const char *dstname = NULL; const char *dstname = NULL;
...@@ -564,10 +564,10 @@ tzparse(const char *name, register struct state * sp, const int lastditch) ...@@ -564,10 +564,10 @@ tzparse(const char *name, register struct state * sp, const int lastditch)
size_t dstlen; size_t dstlen;
long stdoffset; long stdoffset;
long dstoffset; long dstoffset;
register pg_time_t *atp; pg_time_t *atp;
register unsigned char *typep; unsigned char *typep;
register char *cp; char *cp;
register int load_result; int load_result;
stdname = name; stdname = name;
if (lastditch) if (lastditch)
...@@ -614,8 +614,8 @@ tzparse(const char *name, register struct state * sp, const int lastditch) ...@@ -614,8 +614,8 @@ tzparse(const char *name, register struct state * sp, const int lastditch)
{ {
struct rule start; struct rule start;
struct rule end; struct rule end;
register int year; int year;
register pg_time_t janfirst; pg_time_t janfirst;
pg_time_t starttime; pg_time_t starttime;
pg_time_t endtime; pg_time_t endtime;
...@@ -671,12 +671,12 @@ tzparse(const char *name, register struct state * sp, const int lastditch) ...@@ -671,12 +671,12 @@ tzparse(const char *name, register struct state * sp, const int lastditch)
} }
else else
{ {
register long theirstdoffset; long theirstdoffset;
register long theirdstoffset; long theirdstoffset;
register long theiroffset; long theiroffset;
register int isdst; int isdst;
register int i; int i;
register int j; int j;
if (*name != '\0') if (*name != '\0')
return -1; return -1;
...@@ -798,7 +798,7 @@ tzparse(const char *name, register struct state * sp, const int lastditch) ...@@ -798,7 +798,7 @@ tzparse(const char *name, register struct state * sp, const int lastditch)
} }
static void static void
gmtload(struct state * sp) gmtload(struct state *sp)
{ {
if (tzload(gmt, sp) != 0) if (tzload(gmt, sp) != 0)
(void) tzparse(gmt, sp, TRUE); (void) tzparse(gmt, sp, TRUE);
...@@ -814,11 +814,11 @@ gmtload(struct state * sp) ...@@ -814,11 +814,11 @@ gmtload(struct state * sp)
* The unused offset argument is for the benefit of mktime variants. * The unused offset argument is for the benefit of mktime variants.
*/ */
static void static void
localsub(const pg_time_t *timep, const long offset, struct pg_tm * tmp, const pg_tz *tz) localsub(const pg_time_t *timep, long offset, struct pg_tm *tmp, const pg_tz *tz)
{ {
register const struct state *sp; const struct state *sp;
register const struct ttinfo *ttisp; const struct ttinfo *ttisp;
register int i; int i;
const pg_time_t t = *timep; const pg_time_t t = *timep;
sp = &tz->state; sp = &tz->state;
...@@ -859,7 +859,7 @@ pg_localtime(const pg_time_t *timep, const pg_tz *tz) ...@@ -859,7 +859,7 @@ pg_localtime(const pg_time_t *timep, const pg_tz *tz)
* gmtsub is to gmtime as localsub is to localtime. * gmtsub is to gmtime as localsub is to localtime.
*/ */
static void static void
gmtsub(const pg_time_t *timep, const long offset, struct pg_tm * tmp) gmtsub(const pg_time_t *timep, long offset, struct pg_tm *tmp)
{ {
if (!gmt_is_set) if (!gmt_is_set)
{ {
...@@ -888,21 +888,21 @@ pg_gmtime(const pg_time_t *timep) ...@@ -888,21 +888,21 @@ pg_gmtime(const pg_time_t *timep)
static void static void
timesub(const pg_time_t *timep, const long offset, timesub(const pg_time_t *timep, long offset,
register const struct state * sp, register struct pg_tm * tmp) const struct state *sp, struct pg_tm *tmp)
{ {
register const struct lsinfo *lp; const struct lsinfo *lp;
/* expand days to 64 bits to support full Julian-day range */ /* expand days to 64 bits to support full Julian-day range */
register int64 days; int64 days;
register int idays; int idays;
register long rem; long rem;
register int y; int y;
register int yleap; int yleap;
register const int *ip; const int *ip;
register long corr; long corr;
register int hit; int hit;
register int i; int i;
corr = 0; corr = 0;
hit = 0; hit = 0;
...@@ -979,7 +979,7 @@ timesub(const pg_time_t *timep, const long offset, ...@@ -979,7 +979,7 @@ timesub(const pg_time_t *timep, const long offset,
#define LEAPS_THRU_END_OF(y) (((y) + 4800) / 4 - ((y) + 4800) / 100 + ((y) + 4800) / 400) #define LEAPS_THRU_END_OF(y) (((y) + 4800) / 4 - ((y) + 4800) / 100 + ((y) + 4800) / 400)
while (days < 0 || days >= (int64) year_lengths[yleap = isleap(y)]) while (days < 0 || days >= (int64) year_lengths[yleap = isleap(y)])
{ {
register int newy; int newy;
newy = y + days / DAYSPERNYEAR; newy = y + days / DAYSPERNYEAR;
if (days < 0) if (days < 0)
...@@ -1029,8 +1029,8 @@ pg_next_dst_boundary(const pg_time_t *timep, ...@@ -1029,8 +1029,8 @@ pg_next_dst_boundary(const pg_time_t *timep,
int *after_isdst, int *after_isdst,
const pg_tz *tz) const pg_tz *tz)
{ {
register const struct state *sp; const struct state *sp;
register const struct ttinfo *ttisp; const struct ttinfo *ttisp;
int i; int i;
int j; int j;
const pg_time_t t = *timep; const pg_time_t t = *timep;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.34 2005/06/19 21:34:03 tgl Exp $ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.35 2005/06/20 08:00:51 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -97,7 +97,7 @@ static void scan_available_timezones(char *tzdir, char *tzdirsub, ...@@ -97,7 +97,7 @@ static void scan_available_timezones(char *tzdir, char *tzdirsub,
* Get GMT offset from a system struct tm * Get GMT offset from a system struct tm
*/ */
static int static int
get_timezone_offset(struct tm * tm) get_timezone_offset(struct tm *tm)
{ {
#if defined(HAVE_STRUCT_TM_TM_ZONE) #if defined(HAVE_STRUCT_TM_TM_ZONE)
return tm->tm_gmtoff; return tm->tm_gmtoff;
...@@ -128,7 +128,7 @@ build_time_t(int year, int month, int day) ...@@ -128,7 +128,7 @@ build_time_t(int year, int month, int day)
* Does a system tm value match one we computed ourselves? * Does a system tm value match one we computed ourselves?
*/ */
static bool static bool
compare_tm(struct tm * s, struct pg_tm * p) compare_tm(struct tm *s, struct pg_tm *p)
{ {
if (s->tm_sec != p->tm_sec || if (s->tm_sec != p->tm_sec ||
s->tm_min != p->tm_min || s->tm_min != p->tm_min ||
...@@ -155,7 +155,7 @@ compare_tm(struct tm * s, struct pg_tm * p) ...@@ -155,7 +155,7 @@ compare_tm(struct tm * s, struct pg_tm * p)
* test time. * test time.
*/ */
static int static int
score_timezone(const char *tzname, struct tztry * tt) score_timezone(const char *tzname, struct tztry *tt)
{ {
int i; int i;
pg_time_t pgtt; pg_time_t pgtt;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). * 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/scheck.c,v 1.5 2004/05/21 20:59:10 tgl Exp $ * $PostgreSQL: pgsql/src/timezone/scheck.c,v 1.6 2005/06/20 08:00:51 neilc Exp $
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
char * char *
scheck(const char *string, const char *format) scheck(const char *string, const char *format)
{ {
register char *fbuf; char *fbuf;
register const char *fp; const char *fp;
register char *tp; char *tp;
register int c; int c;
register char *result; char *result;
char dummy; char dummy;
static char nada; static char nada;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/strftime.c,v 1.6 2005/04/19 03:13:59 momjian Exp $ * $PostgreSQL: pgsql/src/timezone/strftime.c,v 1.7 2005/06/20 08:00:51 neilc Exp $
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -102,7 +102,7 @@ static char *_fmt(const char *, const struct pg_tm *, char *, ...@@ -102,7 +102,7 @@ static char *_fmt(const char *, const struct pg_tm *, char *,
size_t size_t
pg_strftime(char *s, size_t maxsize, const char *format, pg_strftime(char *s, size_t maxsize, const char *format,
const struct pg_tm * t) const struct pg_tm *t)
{ {
char *p; char *p;
int warn; int warn;
...@@ -116,7 +116,7 @@ pg_strftime(char *s, size_t maxsize, const char *format, ...@@ -116,7 +116,7 @@ pg_strftime(char *s, size_t maxsize, const char *format,
} }
static char * static char *
_fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim, _fmt(const char *format, const struct pg_tm *t, char *pt, const char *ptlim,
int *warnp) int *warnp)
{ {
for (; *format; ++format) for (; *format; ++format)
...@@ -467,7 +467,7 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim, ...@@ -467,7 +467,7 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
} }
static char * static char *
_conv(const int n, const char *format, char *pt, const char *ptlim) _conv(int n, const char *format, char *pt, const char *ptlim)
{ {
char buf[INT_STRLEN_MAXIMUM(int) +1]; char buf[INT_STRLEN_MAXIMUM(int) +1];
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). * 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/zic.c,v 1.14 2005/04/19 03:13:59 momjian Exp $ * $PostgreSQL: pgsql/src/timezone/zic.c,v 1.15 2005/06/20 08:00:51 neilc Exp $
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -134,11 +134,11 @@ static char *memcheck(char *tocheck); ...@@ -134,11 +134,11 @@ static char *memcheck(char *tocheck);
static int mkdirs(char *filename); static int mkdirs(char *filename);
static void newabbr(const char *abbr); static void newabbr(const char *abbr);
static long oadd(long t1, long t2); static long oadd(long t1, long t2);
static void outzone(const struct zone * zp, int ntzones); static void outzone(const struct zone *zp, int ntzones);
static void puttzcode(long code, FILE *fp); static void puttzcode(long code, FILE *fp);
static int rcomp(const void *leftp, const void *rightp); static int rcomp(const void *leftp, const void *rightp);
static pg_time_t rpytime(const struct rule * rp, int wantedy); static pg_time_t rpytime(const struct rule *rp, int wantedy);
static void rulesub(struct rule * rp, static void rulesub(struct rule *rp,
const char *loyearp, const char *hiyearp, const char *loyearp, const char *hiyearp,
const char *typep, const char *monthp, const char *typep, const char *monthp,
const char *dayp, const char *timep); const char *dayp, const char *timep);
...@@ -390,7 +390,7 @@ memcheck(char *ptr) ...@@ -390,7 +390,7 @@ memcheck(char *ptr)
*/ */
static void static void
eats(const char *name, const int num, const char *rname, const int rnum) eats(const char *name, int num, const char *rname, int rnum)
{ {
filename = name; filename = name;
linenum = num; linenum = num;
...@@ -399,7 +399,7 @@ eats(const char *name, const int num, const char *rname, const int rnum) ...@@ -399,7 +399,7 @@ eats(const char *name, const int num, const char *rname, const int rnum)
} }
static void static void
eat(const char *name, const int num) eat(const char *name, int num)
{ {
eats(name, num, (char *) NULL, -1); eats(name, num, (char *) NULL, -1);
} }
...@@ -450,9 +450,9 @@ static int sflag = FALSE; ...@@ -450,9 +450,9 @@ static int sflag = FALSE;
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
register int i; int i;
register int j; int j;
register int c; int c;
#ifndef WIN32 #ifndef WIN32
(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
...@@ -585,8 +585,8 @@ main(int argc, char *argv[]) ...@@ -585,8 +585,8 @@ main(int argc, char *argv[])
static void static void
dolink(const char *fromfile, const char *tofile) dolink(const char *fromfile, const char *tofile)
{ {
register char *fromname; char *fromname;
register char *toname; char *toname;
if (fromfile[0] == '/') if (fromfile[0] == '/')
fromname = ecpyalloc(fromfile); fromname = ecpyalloc(fromfile);
...@@ -625,7 +625,7 @@ dolink(const char *fromfile, const char *tofile) ...@@ -625,7 +625,7 @@ dolink(const char *fromfile, const char *tofile)
!itsdir(fromname)) !itsdir(fromname))
{ {
const char *s = tofile; const char *s = tofile;
register char *symlinkcontents = NULL; char *symlinkcontents = NULL;
while ((s = strchr(s + 1, '/')) != NULL) while ((s = strchr(s + 1, '/')) != NULL)
symlinkcontents = ecatalloc(symlinkcontents, "../"); symlinkcontents = ecatalloc(symlinkcontents, "../");
...@@ -695,8 +695,8 @@ setboundaries(void) ...@@ -695,8 +695,8 @@ setboundaries(void)
static int static int
itsdir(const char *name) itsdir(const char *name)
{ {
register char *myname; char *myname;
register int accres; int accres;
myname = ecpyalloc(name); myname = ecpyalloc(name);
myname = ecatalloc(myname, "/."); myname = ecatalloc(myname, "/.");
...@@ -723,12 +723,12 @@ rcomp(const void *cp1, const void *cp2) ...@@ -723,12 +723,12 @@ rcomp(const void *cp1, const void *cp2)
static void static void
associate(void) associate(void)
{ {
register struct zone *zp; struct zone *zp;
register struct rule *rp; struct rule *rp;
register int base, int base,
out; out;
register int i, int i,
j; j;
if (nrules != 0) if (nrules != 0)
{ {
...@@ -810,13 +810,13 @@ associate(void) ...@@ -810,13 +810,13 @@ associate(void)
static void static void
infile(const char *name) infile(const char *name)
{ {
register FILE *fp; FILE *fp;
register char **fields; char **fields;
register char *cp; char *cp;
register const struct lookup *lp; const struct lookup *lp;
register int nfields; int nfields;
register int wantcont; int wantcont;
register int num; int num;
char buf[BUFSIZ]; char buf[BUFSIZ];
if (strcmp(name, "-") == 0) if (strcmp(name, "-") == 0)
...@@ -925,7 +925,7 @@ infile(const char *name) ...@@ -925,7 +925,7 @@ infile(const char *name)
*---------- *----------
*/ */
static long static long
gethms(const char *string, const char *errstring, const int signable) gethms(const char *string, const char *errstring, int signable)
{ {
int hh, int hh,
mm, mm,
...@@ -969,7 +969,7 @@ gethms(const char *string, const char *errstring, const int signable) ...@@ -969,7 +969,7 @@ gethms(const char *string, const char *errstring, const int signable)
} }
static void static void
inrule(register char **fields, const int nfields) inrule(char **fields, int nfields)
{ {
static struct rule r; static struct rule r;
...@@ -996,9 +996,9 @@ inrule(register char **fields, const int nfields) ...@@ -996,9 +996,9 @@ inrule(register char **fields, const int nfields)
} }
static int static int
inzone(register char **fields, const int nfields) inzone(char **fields, int nfields)
{ {
register int i; int i;
static char *buf; static char *buf;
if (nfields < ZONE_MINFIELDS || nfields > ZONE_MAXFIELDS) if (nfields < ZONE_MINFIELDS || nfields > ZONE_MAXFIELDS)
...@@ -1043,7 +1043,7 @@ inzone(register char **fields, const int nfields) ...@@ -1043,7 +1043,7 @@ inzone(register char **fields, const int nfields)
} }
static int static int
inzcont(register char **fields, const int nfields) inzcont(char **fields, int nfields)
{ {
if (nfields < ZONEC_MINFIELDS || nfields > ZONEC_MAXFIELDS) if (nfields < ZONEC_MINFIELDS || nfields > ZONEC_MAXFIELDS)
{ {
...@@ -1054,18 +1054,18 @@ inzcont(register char **fields, const int nfields) ...@@ -1054,18 +1054,18 @@ inzcont(register char **fields, const int nfields)
} }
static int static int
inzsub(register char **fields, const int nfields, const int iscont) inzsub(char **fields, int nfields, int iscont)
{ {
register char *cp; char *cp;
static struct zone z; static struct zone z;
register int i_gmtoff, int i_gmtoff,
i_rule, i_rule,
i_format; i_format;
register int i_untilyear, int i_untilyear,
i_untilmonth; i_untilmonth;
register int i_untilday, int i_untilday,
i_untiltime; i_untiltime;
register int hasuntil; int hasuntil;
if (iscont) if (iscont)
{ {
...@@ -1140,11 +1140,11 @@ inzsub(register char **fields, const int nfields, const int iscont) ...@@ -1140,11 +1140,11 @@ inzsub(register char **fields, const int nfields, const int iscont)
} }
static void static void
inleap(register char **fields, const int nfields) inleap(char **fields, int nfields)
{ {
register const char *cp; const char *cp;
register const struct lookup *lp; const struct lookup *lp;
register int i, int i,
j; j;
int year, int year,
month, month,
...@@ -1219,7 +1219,7 @@ inleap(register char **fields, const int nfields) ...@@ -1219,7 +1219,7 @@ inleap(register char **fields, const int nfields)
tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE); tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE);
cp = fields[LP_CORR]; cp = fields[LP_CORR];
{ {
register int positive; int positive;
int count; int count;
if (strcmp(cp, "") == 0) if (strcmp(cp, "") == 0)
...@@ -1257,7 +1257,7 @@ inleap(register char **fields, const int nfields) ...@@ -1257,7 +1257,7 @@ inleap(register char **fields, const int nfields)
} }
static void static void
inlink(register char **fields, const int nfields) inlink(char **fields, int nfields)
{ {
struct link l; struct link l;
...@@ -1286,14 +1286,14 @@ inlink(register char **fields, const int nfields) ...@@ -1286,14 +1286,14 @@ inlink(register char **fields, const int nfields)
} }
static void static void
rulesub(register struct rule * rp, const char *loyearp, const char *hiyearp, rulesub(struct rule *rp, const char *loyearp, const char *hiyearp,
const char *typep, const char *monthp, const char *dayp, const char *typep, const char *monthp, const char *dayp,
const char *timep) const char *timep)
{ {
register const struct lookup *lp; const struct lookup *lp;
register const char *cp; const char *cp;
register char *dp; char *dp;
register char *ep; char *ep;
if ((lp = byword(monthp, mon_names)) == NULL) if ((lp = byword(monthp, mon_names)) == NULL)
{ {
...@@ -1464,17 +1464,17 @@ rulesub(register struct rule * rp, const char *loyearp, const char *hiyearp, ...@@ -1464,17 +1464,17 @@ rulesub(register struct rule * rp, const char *loyearp, const char *hiyearp,
} }
static void static void
convert(const long val, char *buf) convert(long val, char *buf)
{ {
register int i; int i;
register long shift; long shift;
for (i = 0, shift = 24; i < 4; ++i, shift -= 8) for (i = 0, shift = 24; i < 4; ++i, shift -= 8)
buf[i] = val >> shift; buf[i] = val >> shift;
} }
static void static void
puttzcode(const long val, FILE *fp) puttzcode(long val, FILE *fp)
{ {
char buf[4]; char buf[4];
...@@ -1496,9 +1496,9 @@ atcomp(const void *avp, const void *bvp) ...@@ -1496,9 +1496,9 @@ atcomp(const void *avp, const void *bvp)
static void static void
writezone(const char *name) writezone(const char *name)
{ {
register FILE *fp; FILE *fp;
register int i, int i,
j; j;
static char *fullname; static char *fullname;
static struct tzhead tzh; static struct tzhead tzh;
pg_time_t ats[TZ_MAX_TIMES]; pg_time_t ats[TZ_MAX_TIMES];
...@@ -1660,7 +1660,7 @@ writezone(const char *name) ...@@ -1660,7 +1660,7 @@ writezone(const char *name)
} }
static void static void
doabbr(char *abbr, const char *format, const char *letters, const int isdst) doabbr(char *abbr, const char *format, const char *letters, int isdst)
{ {
if (strchr(format, '/') == NULL) if (strchr(format, '/') == NULL)
{ {
...@@ -1679,23 +1679,23 @@ doabbr(char *abbr, const char *format, const char *letters, const int isdst) ...@@ -1679,23 +1679,23 @@ doabbr(char *abbr, const char *format, const char *letters, const int isdst)
} }
static void static void
outzone(const struct zone * zpfirst, const int zonecount) outzone(const struct zone *zpfirst, int zonecount)
{ {
register const struct zone *zp; const struct zone *zp;
register struct rule *rp; struct rule *rp;
register int i, int i,
j; j;
register int usestart, int usestart,
useuntil; useuntil;
register pg_time_t starttime = 0; pg_time_t starttime = 0;
register pg_time_t untiltime = 0; pg_time_t untiltime = 0;
register long gmtoff; long gmtoff;
register long stdoff; long stdoff;
register int year; int year;
register long startoff; long startoff;
register int startttisstd; int startttisstd;
register int startttisgmt; int startttisgmt;
register int type; int type;
char startbuf[BUFSIZ]; char startbuf[BUFSIZ];
/* /*
...@@ -1765,10 +1765,9 @@ outzone(const struct zone * zpfirst, const int zonecount) ...@@ -1765,10 +1765,9 @@ outzone(const struct zone * zpfirst, const int zonecount)
} }
for (;;) for (;;)
{ {
register int k; int k;
register pg_time_t jtime, pg_time_t jtime, ktime = 0;
ktime = 0; long offset;
register long offset;
char buf[BUFSIZ]; char buf[BUFSIZ];
if (useuntil) if (useuntil)
...@@ -1915,11 +1914,11 @@ addtt(const pg_time_t starttime, int type) ...@@ -1915,11 +1914,11 @@ addtt(const pg_time_t starttime, int type)
} }
static int static int
addtype(const long gmtoff, const char *abbr, const int isdst, addtype(long gmtoff, const char *abbr, int isdst,
const int ttisstd, const int ttisgmt) int ttisstd, int ttisgmt)
{ {
register int i, int i;
j; int j;
if (isdst != TRUE && isdst != FALSE) if (isdst != TRUE && isdst != FALSE)
{ {
...@@ -1974,10 +1973,10 @@ addtype(const long gmtoff, const char *abbr, const int isdst, ...@@ -1974,10 +1973,10 @@ addtype(const long gmtoff, const char *abbr, const int isdst,
} }
static void static void
leapadd(const pg_time_t t, const int positive, const int rolling, int count) leapadd(const pg_time_t t, int positive, int rolling, int count)
{ {
register int i, int i;
j; int j;
if (leapcnt + (positive ? count : 1) > TZ_MAX_LEAPS) if (leapcnt + (positive ? count : 1) > TZ_MAX_LEAPS)
{ {
...@@ -2012,8 +2011,8 @@ leapadd(const pg_time_t t, const int positive, const int rolling, int count) ...@@ -2012,8 +2011,8 @@ leapadd(const pg_time_t t, const int positive, const int rolling, int count)
static void static void
adjleap(void) adjleap(void)
{ {
register int i; int i;
register long last = 0; long last = 0;
/* /*
* propagate leap seconds forward * propagate leap seconds forward
...@@ -2026,7 +2025,7 @@ adjleap(void) ...@@ -2026,7 +2025,7 @@ adjleap(void)
} }
static int static int
yearistype(const int year, const char *type) yearistype(int year, const char *type)
{ {
static char *buf; static char *buf;
int result; int result;
...@@ -2059,7 +2058,7 @@ lowerit(int a) ...@@ -2059,7 +2058,7 @@ lowerit(int a)
} }
static int static int
ciequal(register const char *ap, register const char *bp) ciequal(const char *ap, const char *bp)
{ {
while (lowerit(*ap) == lowerit(*bp++)) while (lowerit(*ap) == lowerit(*bp++))
if (*ap++ == '\0') if (*ap++ == '\0')
...@@ -2068,7 +2067,7 @@ ciequal(register const char *ap, register const char *bp) ...@@ -2068,7 +2067,7 @@ ciequal(register const char *ap, register const char *bp)
} }
static int static int
itsabbr(register const char *abbr, register const char *word) itsabbr(const char *abbr, const char *word)
{ {
if (lowerit(*abbr) != lowerit(*word)) if (lowerit(*abbr) != lowerit(*word))
return FALSE; return FALSE;
...@@ -2083,10 +2082,10 @@ itsabbr(register const char *abbr, register const char *word) ...@@ -2083,10 +2082,10 @@ itsabbr(register const char *abbr, register const char *word)
} }
static const struct lookup * static const struct lookup *
byword(register const char *word, register const struct lookup * table) byword(const char *word, const struct lookup *table)
{ {
register const struct lookup *foundlp; const struct lookup *foundlp;
register const struct lookup *lp; const struct lookup *lp;
if (word == NULL || table == NULL) if (word == NULL || table == NULL)
return NULL; return NULL;
...@@ -2114,11 +2113,11 @@ byword(register const char *word, register const struct lookup * table) ...@@ -2114,11 +2113,11 @@ byword(register const char *word, register const struct lookup * table)
} }
static char ** static char **
getfields(register char *cp) getfields(char *cp)
{ {
register char *dp; char *dp;
register char **array; char **array;
register int nsubs; int nsubs;
if (cp == NULL) if (cp == NULL)
return NULL; return NULL;
...@@ -2153,9 +2152,9 @@ getfields(register char *cp) ...@@ -2153,9 +2152,9 @@ getfields(register char *cp)
} }
static long static long
oadd(const long t1, const long t2) oadd(long t1, long t2)
{ {
register long t; long t;
t = t1 + t2; t = t1 + t2;
if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1)) if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1))
...@@ -2167,9 +2166,9 @@ oadd(const long t1, const long t2) ...@@ -2167,9 +2166,9 @@ oadd(const long t1, const long t2)
} }
static pg_time_t static pg_time_t
tadd(const pg_time_t t1, const long t2) tadd(const pg_time_t t1, long t2)
{ {
register pg_time_t t; pg_time_t t;
if (t1 == max_time && t2 > 0) if (t1 == max_time && t2 > 0)
return max_time; return max_time;
...@@ -2190,13 +2189,13 @@ tadd(const pg_time_t t1, const long t2) ...@@ -2190,13 +2189,13 @@ tadd(const pg_time_t t1, const long t2)
*/ */
static pg_time_t static pg_time_t
rpytime(register const struct rule * rp, register const int wantedy) rpytime(const struct rule *rp, int wantedy)
{ {
register int y, int y,
m, m,
i; i;
register long dayoff; /* with a nod to Margaret O. */ long dayoff; /* with a nod to Margaret O. */
register pg_time_t t; pg_time_t t;
if (wantedy == INT_MIN) if (wantedy == INT_MIN)
return min_time; return min_time;
...@@ -2240,7 +2239,7 @@ rpytime(register const struct rule * rp, register const int wantedy) ...@@ -2240,7 +2239,7 @@ rpytime(register const struct rule * rp, register const int wantedy)
dayoff = oadd(dayoff, eitol(i)); dayoff = oadd(dayoff, eitol(i));
if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ)
{ {
register long wday; long wday;
#define LDAYSPERWEEK ((long) DAYSPERWEEK) #define LDAYSPERWEEK ((long) DAYSPERWEEK)
wday = eitol(EPOCH_WDAY); wday = eitol(EPOCH_WDAY);
...@@ -2289,7 +2288,7 @@ rpytime(register const struct rule * rp, register const int wantedy) ...@@ -2289,7 +2288,7 @@ rpytime(register const struct rule * rp, register const int wantedy)
static void static void
newabbr(const char *string) newabbr(const char *string)
{ {
register int i; int i;
i = strlen(string) + 1; i = strlen(string) + 1;
if (charcnt + i > TZ_MAX_CHARS) if (charcnt + i > TZ_MAX_CHARS)
...@@ -2304,8 +2303,8 @@ newabbr(const char *string) ...@@ -2304,8 +2303,8 @@ newabbr(const char *string)
static int static int
mkdirs(char *argname) mkdirs(char *argname)
{ {
register char *name; char *name;
register char *cp; char *cp;
if (argname == NULL || *argname == '\0') if (argname == NULL || *argname == '\0')
return 0; return 0;
...@@ -2353,7 +2352,7 @@ mkdirs(char *argname) ...@@ -2353,7 +2352,7 @@ mkdirs(char *argname)
} }
static long static long
eitol(const int i) eitol(int i)
{ {
long l; long l;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册