code cleanup for tz - Mailing list pgsql-patches

From Neil Conway
Subject code cleanup for tz
Date
Msg-id 42B656D4.5090304@samurai.com
Whole thread Raw
Responses Re: code cleanup for tz
List pgsql-patches
This patch makes various cosmetic improvements to the timezone code:
remove the use of the register qualifier, make some function declaration
syntax a bit more consistent, etc.

I'll apply this later today, barring any objections.

-Neil
Index: src/timezone/ialloc.c
===================================================================
RCS file: /var/lib/cvs/pgsql/src/timezone/ialloc.c,v
retrieving revision 1.5
diff -c -r1.5 ialloc.c
*** src/timezone/ialloc.c    21 May 2004 20:59:10 -0000    1.5
--- src/timezone/ialloc.c    20 Jun 2005 05:25:30 -0000
***************
*** 38,46 ****
  char *
  icatalloc(char *old, const char *new)
  {
!     register char *result;
!     register int oldsize,
!                 newsize;

      newsize = (new == NULL) ? 0 : strlen(new);
      if (old == NULL)
--- 38,46 ----
  char *
  icatalloc(char *old, const char *new)
  {
!     char *result;
!     int oldsize,
!         newsize;

      newsize = (new == NULL) ? 0 : strlen(new);
      if (old == NULL)
Index: src/timezone/localtime.c
===================================================================
RCS file: /var/lib/cvs/pgsql/src/timezone/localtime.c,v
retrieving revision 1.10
diff -c -r1.10 localtime.c
*** src/timezone/localtime.c    19 Apr 2005 03:13:59 -0000    1.10
--- src/timezone/localtime.c    20 Jun 2005 05:28:27 -0000
***************
*** 81,95 ****
  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 *getoffset(const char *strp, long *offsetp);
! static const char *getrule(const char *strp, struct rule * rulep);
! static void gmtload(struct state * sp);
! 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 timesub(const pg_time_t *timep, long offset,
!         const struct state * sp, struct pg_tm * tmp);
  static pg_time_t transtime(pg_time_t janfirst, int year,
!                            const struct rule * rulep, long offset);
! int    tzparse(const char *name, struct state * sp, int lastditch);

  /* GMT timezone */
  static struct state gmtmem;
--- 81,95 ----
  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 *getoffset(const char *strp, long *offsetp);
! static const char *getrule(const char *strp, struct rule *rulep);
! static void gmtload(struct state *sp);
! 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 timesub(const pg_time_t *timep, long offset,
!         const struct state *sp, struct pg_tm *tmp);
  static pg_time_t transtime(pg_time_t janfirst, int year,
!                            const struct rule *rulep, long offset);
! int    tzparse(const char *name, struct state *sp, int lastditch);

  /* GMT timezone */
  static struct state gmtmem;
***************
*** 113,120 ****
  static long
  detzcode(const char *codep)
  {
!     register long result;
!     register int i;

      result = (codep[0] & 0x80) ? ~0L : 0L;
      for (i = 0; i < 4; ++i)
--- 113,120 ----
  static long
  detzcode(const char *codep)
  {
!     long result;
!     int i;

      result = (codep[0] & 0x80) ? ~0L : 0L;
      for (i = 0; i < 4; ++i)
***************
*** 123,138 ****
  }

  int
! tzload(register const char *name, register struct state * sp)
  {
!     register const char *p;
!     register int i;
!     register int fid;

      if (name == NULL && (name = TZDEFAULT) == NULL)
          return -1;
      {
!         register int doaccess;
          char        fullname[MAXPGPATH];

          if (name[0] == ':')
--- 123,138 ----
  }

  int
! tzload(const char *name, struct state *sp)
  {
!     const char *p;
!     int i;
!     int fid;

      if (name == NULL && (name = TZDEFAULT) == NULL)
          return -1;
      {
!         int doaccess;
          char        fullname[MAXPGPATH];

          if (name[0] == ':')
***************
*** 209,215 ****
          }
          for (i = 0; i < sp->typecnt; ++i)
          {
!             register struct ttinfo *ttisp;

              ttisp = &sp->ttis[i];
              ttisp->tt_gmtoff = detzcode(p);
--- 209,215 ----
          }
          for (i = 0; i < sp->typecnt; ++i)
          {
!             struct ttinfo *ttisp;

              ttisp = &sp->ttis[i];
              ttisp->tt_gmtoff = detzcode(p);
***************
*** 227,233 ****
          sp->chars[i] = '\0';    /* ensure '\0' at end */
          for (i = 0; i < sp->leapcnt; ++i)
          {
!             register struct lsinfo *lsisp;

              lsisp = &sp->lsis[i];
              lsisp->ls_trans = detzcode(p);
--- 227,233 ----
          sp->chars[i] = '\0';    /* ensure '\0' at end */
          for (i = 0; i < sp->leapcnt; ++i)
          {
!             struct lsinfo *lsisp;

              lsisp = &sp->lsis[i];
              lsisp->ls_trans = detzcode(p);
***************
*** 237,243 ****
          }
          for (i = 0; i < sp->typecnt; ++i)
          {
!             register struct ttinfo *ttisp;

              ttisp = &sp->ttis[i];
              if (ttisstdcnt == 0)
--- 237,243 ----
          }
          for (i = 0; i < sp->typecnt; ++i)
          {
!             struct ttinfo *ttisp;

              ttisp = &sp->ttis[i];
              if (ttisstdcnt == 0)
***************
*** 252,258 ****
          }
          for (i = 0; i < sp->typecnt; ++i)
          {
!             register struct ttinfo *ttisp;

              ttisp = &sp->ttis[i];
              if (ttisgmtcnt == 0)
--- 252,258 ----
          }
          for (i = 0; i < sp->typecnt; ++i)
          {
!             struct ttinfo *ttisp;

              ttisp = &sp->ttis[i];
              if (ttisgmtcnt == 0)
***************
*** 284,292 ****
   * character.
   */
  static const char *
! getzname(register const char *strp)
  {
!     register char c;

      while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
             c != '+')
--- 284,292 ----
   * character.
   */
  static const char *
! getzname(const char *strp)
  {
!     char c;

      while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
             c != '+')
***************
*** 301,310 ****
   * Otherwise, return a pointer to the first character not part of the number.
   */
  static const char *
! getnum(register const char *strp, int *nump, const int min, const int max)
  {
!     register char c;
!     register int num;

      if (strp == NULL || !is_digit(c = *strp))
          return NULL;
--- 301,310 ----
   * Otherwise, return a pointer to the first character not part of the number.
   */
  static const char *
! getnum(const char *strp, int *nump, int min, int max)
  {
!     char c;
!     int num;

      if (strp == NULL || !is_digit(c = *strp))
          return NULL;
***************
*** 330,336 ****
   * of seconds.
   */
  static const char *
! getsecs(register const char *strp, long *secsp)
  {
      int            num;

--- 330,336 ----
   * of seconds.
   */
  static const char *
! getsecs(const char *strp, long *secsp)
  {
      int            num;

***************
*** 370,378 ****
   * Otherwise, return a pointer to the first character not part of the time.
   */
  static const char *
! getoffset(register const char *strp, long *offsetp)
  {
!     register int neg = 0;

      if (*strp == '-')
      {
--- 370,378 ----
   * Otherwise, return a pointer to the first character not part of the time.
   */
  static const char *
! getoffset(const char *strp, long *offsetp)
  {
!     int neg = 0;

      if (*strp == '-')
      {
***************
*** 396,402 ****
   * Otherwise, return a pointer to the first character not part of the rule.
   */
  static const char *
! getrule(const char *strp, register struct rule * rulep)
  {
      if (*strp == 'J')
      {
--- 396,402 ----
   * Otherwise, return a pointer to the first character not part of the rule.
   */
  static const char *
! getrule(const char *strp, struct rule *rulep)
  {
      if (*strp == 'J')
      {
***************
*** 457,469 ****
   * calculate the Epoch-relative time that rule takes effect.
   */
  static pg_time_t
! transtime(const pg_time_t janfirst, const int year,
!           register const struct rule * rulep, const long offset)
  {
!     register int leapyear;
!     register pg_time_t value = 0;
!     register int i;
!     int            d,
                  m1,
                  yy0,
                  yy1,
--- 457,469 ----
   * calculate the Epoch-relative time that rule takes effect.
   */
  static pg_time_t
! transtime(const pg_time_t janfirst, int year,
!           const struct rule *rulep, long offset)
  {
!     int leapyear;
!     pg_time_t value = 0;
!     int            i,
!                 d,
                  m1,
                  yy0,
                  yy1,
***************
*** 556,562 ****
   */

  int
! tzparse(const char *name, register struct state * sp, const int lastditch)
  {
      const char *stdname;
      const char *dstname = NULL;
--- 556,562 ----
   */

  int
! tzparse(const char *name, struct state *sp, int lastditch)
  {
      const char *stdname;
      const char *dstname = NULL;
***************
*** 564,573 ****
      size_t        dstlen;
      long        stdoffset;
      long        dstoffset;
!     register pg_time_t *atp;
!     register unsigned char *typep;
!     register char *cp;
!     register int load_result;

      stdname = name;
      if (lastditch)
--- 564,573 ----
      size_t        dstlen;
      long        stdoffset;
      long        dstoffset;
!     pg_time_t *atp;
!     unsigned char *typep;
!     char *cp;
!     int load_result;

      stdname = name;
      if (lastditch)
***************
*** 614,621 ****
          {
              struct rule start;
              struct rule end;
!             register int year;
!             register pg_time_t janfirst;
              pg_time_t    starttime;
              pg_time_t    endtime;

--- 614,621 ----
          {
              struct rule start;
              struct rule end;
!             int year;
!             pg_time_t janfirst;
              pg_time_t    starttime;
              pg_time_t    endtime;

***************
*** 671,682 ****
          }
          else
          {
!             register long theirstdoffset;
!             register long theirdstoffset;
!             register long theiroffset;
!             register int isdst;
!             register int i;
!             register int j;

              if (*name != '\0')
                  return -1;
--- 671,682 ----
          }
          else
          {
!             long theirstdoffset;
!             long theirdstoffset;
!             long theiroffset;
!             int isdst;
!             int i;
!             int j;

              if (*name != '\0')
                  return -1;
***************
*** 798,804 ****
  }

  static void
! gmtload(struct state * sp)
  {
      if (tzload(gmt, sp) != 0)
          (void) tzparse(gmt, sp, TRUE);
--- 798,804 ----
  }

  static void
! gmtload(struct state *sp)
  {
      if (tzload(gmt, sp) != 0)
          (void) tzparse(gmt, sp, TRUE);
***************
*** 814,824 ****
   * The unused offset argument is for the benefit of mktime variants.
   */
  static void
! localsub(const pg_time_t *timep, const long offset, struct pg_tm * tmp, const pg_tz *tz)
  {
!      register const struct state *sp;
!     register const struct ttinfo *ttisp;
!     register int i;
      const pg_time_t t = *timep;

      sp = &tz->state;
--- 814,824 ----
   * The unused offset argument is for the benefit of mktime variants.
   */
  static void
! localsub(const pg_time_t *timep, long offset, struct pg_tm *tmp, const pg_tz *tz)
  {
!      const struct state *sp;
!     const struct ttinfo *ttisp;
!     int i;
      const pg_time_t t = *timep;

      sp = &tz->state;
***************
*** 859,865 ****
   * gmtsub is to gmtime as localsub is to localtime.
   */
  static void
! gmtsub(const pg_time_t *timep, const long offset, struct pg_tm * tmp)
  {
      if (!gmt_is_set)
      {
--- 859,865 ----
   * gmtsub is to gmtime as localsub is to localtime.
   */
  static void
! gmtsub(const pg_time_t *timep, long offset, struct pg_tm *tmp)
  {
      if (!gmt_is_set)
      {
***************
*** 888,908 ****


  static void
! timesub(const pg_time_t *timep, const long offset,
!         register const struct state * sp, register struct pg_tm * tmp)
  {
!     register const struct lsinfo *lp;

      /* expand days to 64 bits to support full Julian-day range */
!     register int64 days;
!     register int idays;
!     register long rem;
!     register int y;
!     register int yleap;
!     register const int *ip;
!     register long corr;
!     register int hit;
!     register int i;

      corr = 0;
      hit = 0;
--- 888,908 ----


  static void
! timesub(const pg_time_t *timep, long offset,
!         const struct state *sp, struct pg_tm *tmp)
  {
!     const struct lsinfo *lp;

      /* expand days to 64 bits to support full Julian-day range */
!     int64 days;
!     int idays;
!     long rem;
!     int y;
!     int yleap;
!     const int *ip;
!     long corr;
!     int hit;
!     int i;

      corr = 0;
      hit = 0;
***************
*** 979,985 ****
  #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)])
      {
!         register int newy;

          newy = y + days / DAYSPERNYEAR;
          if (days < 0)
--- 979,985 ----
  #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)])
      {
!         int newy;

          newy = y + days / DAYSPERNYEAR;
          if (days < 0)
***************
*** 1029,1036 ****
                       int *after_isdst,
                       const pg_tz *tz)
  {
!     register const struct state *sp;
!     register const struct ttinfo *ttisp;
      int i;
      int j;
      const pg_time_t t = *timep;
--- 1029,1036 ----
                       int *after_isdst,
                       const pg_tz *tz)
  {
!     const struct state *sp;
!     const struct ttinfo *ttisp;
      int i;
      int j;
      const pg_time_t t = *timep;
Index: src/timezone/pgtz.c
===================================================================
RCS file: /var/lib/cvs/pgsql/src/timezone/pgtz.c,v
retrieving revision 1.34
diff -c -r1.34 pgtz.c
*** src/timezone/pgtz.c    19 Jun 2005 21:34:03 -0000    1.34
--- src/timezone/pgtz.c    20 Jun 2005 05:35:33 -0000
***************
*** 97,103 ****
   * Get GMT offset from a system struct tm
   */
  static int
! get_timezone_offset(struct tm * tm)
  {
  #if defined(HAVE_STRUCT_TM_TM_ZONE)
      return tm->tm_gmtoff;
--- 97,103 ----
   * Get GMT offset from a system struct tm
   */
  static int
! get_timezone_offset(struct tm *tm)
  {
  #if defined(HAVE_STRUCT_TM_TM_ZONE)
      return tm->tm_gmtoff;
***************
*** 128,134 ****
   * Does a system tm value match one we computed ourselves?
   */
  static bool
! compare_tm(struct tm * s, struct pg_tm * p)
  {
      if (s->tm_sec != p->tm_sec ||
          s->tm_min != p->tm_min ||
--- 128,134 ----
   * Does a system tm value match one we computed ourselves?
   */
  static bool
! compare_tm(struct tm *s, struct pg_tm *p)
  {
      if (s->tm_sec != p->tm_sec ||
          s->tm_min != p->tm_min ||
***************
*** 155,161 ****
   * test time.
   */
  static int
! score_timezone(const char *tzname, struct tztry * tt)
  {
      int            i;
      pg_time_t    pgtt;
--- 155,161 ----
   * test time.
   */
  static int
! score_timezone(const char *tzname, struct tztry *tt)
  {
      int            i;
      pg_time_t    pgtt;
Index: src/timezone/scheck.c
===================================================================
RCS file: /var/lib/cvs/pgsql/src/timezone/scheck.c,v
retrieving revision 1.5
diff -c -r1.5 scheck.c
*** src/timezone/scheck.c    21 May 2004 20:59:10 -0000    1.5
--- src/timezone/scheck.c    20 Jun 2005 05:25:47 -0000
***************
*** 14,24 ****
  char *
  scheck(const char *string, const char *format)
  {
!     register char *fbuf;
!     register const char *fp;
!     register char *tp;
!     register int c;
!     register char *result;
      char        dummy;
      static char nada;

--- 14,24 ----
  char *
  scheck(const char *string, const char *format)
  {
!     char *fbuf;
!     const char *fp;
!     char *tp;
!     int c;
!     char *result;
      char        dummy;
      static char nada;

Index: src/timezone/strftime.c
===================================================================
RCS file: /var/lib/cvs/pgsql/src/timezone/strftime.c,v
retrieving revision 1.6
diff -c -r1.6 strftime.c
*** src/timezone/strftime.c    19 Apr 2005 03:13:59 -0000    1.6
--- src/timezone/strftime.c    20 Jun 2005 05:34:26 -0000
***************
*** 102,108 ****

  size_t
  pg_strftime(char *s, size_t maxsize, const char *format,
!             const struct pg_tm * t)
  {
      char       *p;
      int            warn;
--- 102,108 ----

  size_t
  pg_strftime(char *s, size_t maxsize, const char *format,
!             const struct pg_tm *t)
  {
      char       *p;
      int            warn;
***************
*** 116,122 ****
  }

  static char *
! _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
       int *warnp)
  {
      for (; *format; ++format)
--- 116,122 ----
  }

  static char *
! _fmt(const char *format, const struct pg_tm *t, char *pt, const char *ptlim,
       int *warnp)
  {
      for (; *format; ++format)
***************
*** 467,473 ****
  }

  static char *
! _conv(const int n, const char *format, char *pt, const char *ptlim)
  {
      char        buf[INT_STRLEN_MAXIMUM(int) +1];

--- 467,473 ----
  }

  static char *
! _conv(int n, const char *format, char *pt, const char *ptlim)
  {
      char        buf[INT_STRLEN_MAXIMUM(int) +1];

Index: src/timezone/zic.c
===================================================================
RCS file: /var/lib/cvs/pgsql/src/timezone/zic.c,v
retrieving revision 1.14
diff -c -r1.14 zic.c
*** src/timezone/zic.c    19 Apr 2005 03:13:59 -0000    1.14
--- src/timezone/zic.c    20 Jun 2005 05:31:09 -0000
***************
*** 134,144 ****
  static int    mkdirs(char *filename);
  static void newabbr(const char *abbr);
  static long oadd(long t1, long t2);
! static void outzone(const struct zone * zp, int ntzones);
  static void puttzcode(long code, FILE *fp);
  static int    rcomp(const void *leftp, const void *rightp);
! static pg_time_t rpytime(const struct rule * rp, int wantedy);
! static void rulesub(struct rule * rp,
          const char *loyearp, const char *hiyearp,
          const char *typep, const char *monthp,
          const char *dayp, const char *timep);
--- 134,144 ----
  static int    mkdirs(char *filename);
  static void newabbr(const char *abbr);
  static long oadd(long t1, long t2);
! static void outzone(const struct zone *zp, int ntzones);
  static void puttzcode(long code, FILE *fp);
  static int    rcomp(const void *leftp, const void *rightp);
! static pg_time_t rpytime(const struct rule *rp, int wantedy);
! static void rulesub(struct rule *rp,
          const char *loyearp, const char *hiyearp,
          const char *typep, const char *monthp,
          const char *dayp, const char *timep);
***************
*** 390,396 ****
   */

  static void
! eats(const char *name, const int num, const char *rname, const int rnum)
  {
      filename = name;
      linenum = num;
--- 390,396 ----
   */

  static void
! eats(const char *name, int num, const char *rname, int rnum)
  {
      filename = name;
      linenum = num;
***************
*** 399,405 ****
  }

  static void
! eat(const char *name, const int num)
  {
      eats(name, num, (char *) NULL, -1);
  }
--- 399,405 ----
  }

  static void
! eat(const char *name, int num)
  {
      eats(name, num, (char *) NULL, -1);
  }
***************
*** 450,458 ****
  int
  main(int argc, char *argv[])
  {
!     register int i;
!     register int j;
!     register int c;

  #ifndef WIN32
      (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
--- 450,458 ----
  int
  main(int argc, char *argv[])
  {
!     int i;
!     int j;
!     int c;

  #ifndef WIN32
      (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
***************
*** 585,592 ****
  static void
  dolink(const char *fromfile, const char *tofile)
  {
!     register char *fromname;
!     register char *toname;

      if (fromfile[0] == '/')
          fromname = ecpyalloc(fromfile);
--- 585,592 ----
  static void
  dolink(const char *fromfile, const char *tofile)
  {
!     char *fromname;
!     char *toname;

      if (fromfile[0] == '/')
          fromname = ecpyalloc(fromfile);
***************
*** 625,631 ****
              !itsdir(fromname))
          {
              const char *s = tofile;
!             register char *symlinkcontents = NULL;

              while ((s = strchr(s + 1, '/')) != NULL)
                  symlinkcontents = ecatalloc(symlinkcontents, "../");
--- 625,631 ----
              !itsdir(fromname))
          {
              const char *s = tofile;
!             char *symlinkcontents = NULL;

              while ((s = strchr(s + 1, '/')) != NULL)
                  symlinkcontents = ecatalloc(symlinkcontents, "../");
***************
*** 695,702 ****
  static int
  itsdir(const char *name)
  {
!     register char *myname;
!     register int accres;

      myname = ecpyalloc(name);
      myname = ecatalloc(myname, "/.");
--- 695,702 ----
  static int
  itsdir(const char *name)
  {
!     char *myname;
!     int accres;

      myname = ecpyalloc(name);
      myname = ecatalloc(myname, "/.");
***************
*** 723,734 ****
  static void
  associate(void)
  {
!     register struct zone *zp;
!     register struct rule *rp;
!     register int base,
!                 out;
!     register int i,
!                 j;

      if (nrules != 0)
      {
--- 723,734 ----
  static void
  associate(void)
  {
!     struct zone *zp;
!     struct rule *rp;
!     int base,
!         out;
!     int i,
!         j;

      if (nrules != 0)
      {
***************
*** 810,822 ****
  static void
  infile(const char *name)
  {
!     register FILE *fp;
!     register char **fields;
!     register char *cp;
!     register const struct lookup *lp;
!     register int nfields;
!     register int wantcont;
!     register int num;
      char        buf[BUFSIZ];

      if (strcmp(name, "-") == 0)
--- 810,822 ----
  static void
  infile(const char *name)
  {
!     FILE *fp;
!     char **fields;
!     char *cp;
!     const struct lookup *lp;
!     int nfields;
!     int wantcont;
!     int num;
      char        buf[BUFSIZ];

      if (strcmp(name, "-") == 0)
***************
*** 925,931 ****
   *----------
   */
  static long
! gethms(const char *string, const char *errstring, const int signable)
  {
      int            hh,
                  mm,
--- 925,931 ----
   *----------
   */
  static long
! gethms(const char *string, const char *errstring, int signable)
  {
      int            hh,
                  mm,
***************
*** 969,975 ****
  }

  static void
! inrule(register char **fields, const int nfields)
  {
      static struct rule r;

--- 969,975 ----
  }

  static void
! inrule(char **fields, int nfields)
  {
      static struct rule r;

***************
*** 996,1004 ****
  }

  static int
! inzone(register char **fields, const int nfields)
  {
!     register int i;
      static char *buf;

      if (nfields < ZONE_MINFIELDS || nfields > ZONE_MAXFIELDS)
--- 996,1004 ----
  }

  static int
! inzone(char **fields, int nfields)
  {
!     int i;
      static char *buf;

      if (nfields < ZONE_MINFIELDS || nfields > ZONE_MAXFIELDS)
***************
*** 1043,1049 ****
  }

  static int
! inzcont(register char **fields, const int nfields)
  {
      if (nfields < ZONEC_MINFIELDS || nfields > ZONEC_MAXFIELDS)
      {
--- 1043,1049 ----
  }

  static int
! inzcont(char **fields, int nfields)
  {
      if (nfields < ZONEC_MINFIELDS || nfields > ZONEC_MAXFIELDS)
      {
***************
*** 1054,1071 ****
  }

  static int
! inzsub(register char **fields, const int nfields, const int iscont)
  {
!     register char *cp;
      static struct zone z;
!     register int i_gmtoff,
!                 i_rule,
!                 i_format;
!     register int i_untilyear,
!                 i_untilmonth;
!     register int i_untilday,
!                 i_untiltime;
!     register int hasuntil;

      if (iscont)
      {
--- 1054,1071 ----
  }

  static int
! inzsub(char **fields, int nfields, int iscont)
  {
!     char *cp;
      static struct zone z;
!     int i_gmtoff,
!         i_rule,
!         i_format;
!     int i_untilyear,
!         i_untilmonth;
!     int i_untilday,
!         i_untiltime;
!     int hasuntil;

      if (iscont)
      {
***************
*** 1140,1150 ****
  }

  static void
! inleap(register char **fields, const int nfields)
  {
!     register const char *cp;
!     register const struct lookup *lp;
!     register int i,
                  j;
      int            year,
                  month,
--- 1140,1150 ----
  }

  static void
! inleap(char **fields, int nfields)
  {
!     const char *cp;
!     const struct lookup *lp;
!     int            i,
                  j;
      int            year,
                  month,
***************
*** 1219,1225 ****
      tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE);
      cp = fields[LP_CORR];
      {
!         register int positive;
          int            count;

          if (strcmp(cp, "") == 0)
--- 1219,1225 ----
      tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE);
      cp = fields[LP_CORR];
      {
!         int            positive;
          int            count;

          if (strcmp(cp, "") == 0)
***************
*** 1257,1263 ****
  }

  static void
! inlink(register char **fields, const int nfields)
  {
      struct link l;

--- 1257,1263 ----
  }

  static void
! inlink(char **fields, int nfields)
  {
      struct link l;

***************
*** 1286,1299 ****
  }

  static void
! rulesub(register struct rule * rp, const char *loyearp, const char *hiyearp,
          const char *typep, const char *monthp, const char *dayp,
          const char *timep)
  {
!     register const struct lookup *lp;
!     register const char *cp;
!     register char *dp;
!     register char *ep;

      if ((lp = byword(monthp, mon_names)) == NULL)
      {
--- 1286,1299 ----
  }

  static void
! rulesub(struct rule *rp, const char *loyearp, const char *hiyearp,
          const char *typep, const char *monthp, const char *dayp,
          const char *timep)
  {
!     const struct lookup *lp;
!     const char *cp;
!     char *dp;
!     char *ep;

      if ((lp = byword(monthp, mon_names)) == NULL)
      {
***************
*** 1464,1480 ****
  }

  static void
! convert(const long val, char *buf)
  {
!     register int i;
!     register long shift;

      for (i = 0, shift = 24; i < 4; ++i, shift -= 8)
          buf[i] = val >> shift;
  }

  static void
! puttzcode(const long val, FILE *fp)
  {
      char        buf[4];

--- 1464,1480 ----
  }

  static void
! convert(long val, char *buf)
  {
!     int i;
!     long shift;

      for (i = 0, shift = 24; i < 4; ++i, shift -= 8)
          buf[i] = val >> shift;
  }

  static void
! puttzcode(long val, FILE *fp)
  {
      char        buf[4];

***************
*** 1496,1504 ****
  static void
  writezone(const char *name)
  {
!     register FILE *fp;
!     register int i,
!                 j;
      static char *fullname;
      static struct tzhead tzh;
      pg_time_t    ats[TZ_MAX_TIMES];
--- 1496,1504 ----
  static void
  writezone(const char *name)
  {
!     FILE *fp;
!     int    i,
!         j;
      static char *fullname;
      static struct tzhead tzh;
      pg_time_t    ats[TZ_MAX_TIMES];
***************
*** 1660,1666 ****
  }

  static void
! doabbr(char *abbr, const char *format, const char *letters, const int isdst)
  {
      if (strchr(format, '/') == NULL)
      {
--- 1660,1666 ----
  }

  static void
! doabbr(char *abbr, const char *format, const char *letters, int isdst)
  {
      if (strchr(format, '/') == NULL)
      {
***************
*** 1679,1701 ****
  }

  static void
! outzone(const struct zone * zpfirst, const int zonecount)
  {
!     register const struct zone *zp;
!     register struct rule *rp;
!     register int i,
!                 j;
!     register int usestart,
!                 useuntil;
!     register pg_time_t starttime = 0;
!     register pg_time_t untiltime = 0;
!     register long gmtoff;
!     register long stdoff;
!     register int year;
!     register long startoff;
!     register int startttisstd;
!     register int startttisgmt;
!     register int type;
      char        startbuf[BUFSIZ];

      /*
--- 1679,1701 ----
  }

  static void
! outzone(const struct zone *zpfirst, int zonecount)
  {
!     const struct zone *zp;
!     struct rule *rp;
!     int i,
!         j;
!     int usestart,
!         useuntil;
!     pg_time_t starttime = 0;
!     pg_time_t untiltime = 0;
!     long gmtoff;
!     long stdoff;
!     int year;
!     long startoff;
!     int startttisstd;
!     int startttisgmt;
!     int type;
      char        startbuf[BUFSIZ];

      /*
***************
*** 1765,1774 ****
                  }
                  for (;;)
                  {
!                     register int k;
!                     register pg_time_t jtime,
!                                 ktime = 0;
!                     register long offset;
                      char        buf[BUFSIZ];

                      if (useuntil)
--- 1765,1773 ----
                  }
                  for (;;)
                  {
!                     int k;
!                     pg_time_t jtime, ktime = 0;
!                     long offset;
                      char        buf[BUFSIZ];

                      if (useuntil)
***************
*** 1915,1925 ****
  }

  static int
! addtype(const long gmtoff, const char *abbr, const int isdst,
!         const int ttisstd, const int ttisgmt)
  {
!     register int i,
!                 j;

      if (isdst != TRUE && isdst != FALSE)
      {
--- 1914,1924 ----
  }

  static int
! addtype(long gmtoff, const char *abbr, int isdst,
!         int ttisstd, int ttisgmt)
  {
!     int i;
!     int j;

      if (isdst != TRUE && isdst != FALSE)
      {
***************
*** 1974,1983 ****
  }

  static void
! leapadd(const pg_time_t t, const int positive, const int rolling, int count)
  {
!     register int i,
!                 j;

      if (leapcnt + (positive ? count : 1) > TZ_MAX_LEAPS)
      {
--- 1973,1982 ----
  }

  static void
! leapadd(const pg_time_t t, int positive, int rolling, int count)
  {
!     int i;
!     int j;

      if (leapcnt + (positive ? count : 1) > TZ_MAX_LEAPS)
      {
***************
*** 2012,2019 ****
  static void
  adjleap(void)
  {
!     register int i;
!     register long last = 0;

      /*
       * propagate leap seconds forward
--- 2011,2018 ----
  static void
  adjleap(void)
  {
!     int i;
!     long last = 0;

      /*
       * propagate leap seconds forward
***************
*** 2026,2032 ****
  }

  static int
! yearistype(const int year, const char *type)
  {
      static char *buf;
      int            result;
--- 2025,2031 ----
  }

  static int
! yearistype(int year, const char *type)
  {
      static char *buf;
      int            result;
***************
*** 2059,2065 ****
  }

  static int
! ciequal(register const char *ap, register const char *bp)
  {
      while (lowerit(*ap) == lowerit(*bp++))
          if (*ap++ == '\0')
--- 2058,2064 ----
  }

  static int
! ciequal(const char *ap, const char *bp)
  {
      while (lowerit(*ap) == lowerit(*bp++))
          if (*ap++ == '\0')
***************
*** 2068,2074 ****
  }

  static int
! itsabbr(register const char *abbr, register const char *word)
  {
      if (lowerit(*abbr) != lowerit(*word))
          return FALSE;
--- 2067,2073 ----
  }

  static int
! itsabbr(const char *abbr, const char *word)
  {
      if (lowerit(*abbr) != lowerit(*word))
          return FALSE;
***************
*** 2083,2092 ****
  }

  static const struct lookup *
! byword(register const char *word, register const struct lookup * table)
  {
!     register const struct lookup *foundlp;
!     register const struct lookup *lp;

      if (word == NULL || table == NULL)
          return NULL;
--- 2082,2091 ----
  }

  static const struct lookup *
! byword(const char *word, const struct lookup *table)
  {
!     const struct lookup *foundlp;
!     const struct lookup *lp;

      if (word == NULL || table == NULL)
          return NULL;
***************
*** 2114,2124 ****
  }

  static char **
! getfields(register char *cp)
  {
!     register char *dp;
!     register char **array;
!     register int nsubs;

      if (cp == NULL)
          return NULL;
--- 2113,2123 ----
  }

  static char **
! getfields(char *cp)
  {
!     char *dp;
!     char **array;
!     int nsubs;

      if (cp == NULL)
          return NULL;
***************
*** 2153,2161 ****
  }

  static long
! oadd(const long t1, const long t2)
  {
!     register long t;

      t = t1 + t2;
      if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1))
--- 2152,2160 ----
  }

  static long
! oadd(long t1, long t2)
  {
!     long t;

      t = t1 + t2;
      if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1))
***************
*** 2167,2175 ****
  }

  static pg_time_t
! tadd(const pg_time_t t1, const long t2)
  {
!     register pg_time_t t;

      if (t1 == max_time && t2 > 0)
          return max_time;
--- 2166,2174 ----
  }

  static pg_time_t
! tadd(const pg_time_t t1, long t2)
  {
!     pg_time_t t;

      if (t1 == max_time && t2 > 0)
          return max_time;
***************
*** 2190,2202 ****
   */

  static pg_time_t
! rpytime(register const struct rule * rp, register const int wantedy)
  {
!     register int y,
!                 m,
!                 i;
!     register long dayoff;        /* with a nod to Margaret O. */
!     register pg_time_t t;

      if (wantedy == INT_MIN)
          return min_time;
--- 2189,2201 ----
   */

  static pg_time_t
! rpytime(const struct rule *rp, int wantedy)
  {
!     int y,
!         m,
!         i;
!     long dayoff;        /* with a nod to Margaret O. */
!     pg_time_t t;

      if (wantedy == INT_MIN)
          return min_time;
***************
*** 2240,2246 ****
      dayoff = oadd(dayoff, eitol(i));
      if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ)
      {
!         register long wday;

  #define LDAYSPERWEEK    ((long) DAYSPERWEEK)
          wday = eitol(EPOCH_WDAY);
--- 2239,2245 ----
      dayoff = oadd(dayoff, eitol(i));
      if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ)
      {
!         long wday;

  #define LDAYSPERWEEK    ((long) DAYSPERWEEK)
          wday = eitol(EPOCH_WDAY);
***************
*** 2289,2295 ****
  static void
  newabbr(const char *string)
  {
!     register int i;

      i = strlen(string) + 1;
      if (charcnt + i > TZ_MAX_CHARS)
--- 2288,2294 ----
  static void
  newabbr(const char *string)
  {
!     int i;

      i = strlen(string) + 1;
      if (charcnt + i > TZ_MAX_CHARS)
***************
*** 2304,2311 ****
  static int
  mkdirs(char *argname)
  {
!     register char *name;
!     register char *cp;

      if (argname == NULL || *argname == '\0')
          return 0;
--- 2303,2310 ----
  static int
  mkdirs(char *argname)
  {
!     char *name;
!     char *cp;

      if (argname == NULL || *argname == '\0')
          return 0;
***************
*** 2353,2359 ****
  }

  static long
! eitol(const int i)
  {
      long        l;

--- 2352,2358 ----
  }

  static long
! eitol(int i)
  {
      long        l;


pgsql-patches by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Python setof patch
Next
From: Andrew Dunstan
Date:
Subject: plperl better array support