about summary refs log tree commit diff
path: root/time/tzfile.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-03-30 18:35:32 +0000
committerUlrich Drepper <drepper@redhat.com>1999-03-30 18:35:32 +0000
commitd3345073260908c1140377190c2950b8b3f81a42 (patch)
tree3454196f8fd07cd44292835ec31116419f265789 /time/tzfile.c
parent57de50372c3bf86ba185b2e6b07fb4fb6caca3d8 (diff)
downloadglibc-d3345073260908c1140377190c2950b8b3f81a42.tar.gz
glibc-d3345073260908c1140377190c2950b8b3f81a42.tar.xz
glibc-d3345073260908c1140377190c2950b8b3f81a42.zip
Update.
1999-03-30  Ulrich Drepper  <drepper@cygnus.com>

	* time/tzfile.c (__tzfile_read): Process transitions from the rear.
	Minor optimization.
Diffstat (limited to 'time/tzfile.c')
-rw-r--r--time/tzfile.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/time/tzfile.c b/time/tzfile.c
index a7407316f3..cfbdae6886 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,95,96,97,98,99 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -284,10 +284,11 @@ __tzfile_read (const char *file)
     {
       int type = type_idxs[--i];
       int dst = types[type].isdst;
-      int idx = types[type].idx;
 
       if (__tzname[dst] == NULL)
 	{
+	  int idx = types[type].idx;
+
 	  __tzname[dst] = __tzstring (&zone_names[idx]);
 
 	  if (__tzname[1 - dst] != NULL)
@@ -313,14 +314,15 @@ __tzfile_read (const char *file)
     {
       int stdoff_set = 0, dstoff_set = 0;
       rule_stdoff = rule_dstoff = 0;
-      for (i = 0; i < num_transitions; ++i)
+      i = num_transitions - 1;
+      do
 	{
 	  if (!stdoff_set && !types[type_idxs[i]].isdst)
 	    {
 	      stdoff_set = 1;
 	      rule_stdoff = types[type_idxs[i]].offset;
 	    }
-	  if (!dstoff_set && types[type_idxs[i]].isdst)
+	  else if (!dstoff_set && types[type_idxs[i]].isdst)
 	    {
 	      dstoff_set = 1;
 	      rule_dstoff = types[type_idxs[i]].offset;
@@ -328,6 +330,8 @@ __tzfile_read (const char *file)
 	  if (stdoff_set && dstoff_set)
 	    break;
 	}
+      while (i-- > 0);
+
       if (!dstoff_set)
 	rule_dstoff = rule_stdoff;
     }