From d3345073260908c1140377190c2950b8b3f81a42 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 30 Mar 1999 18:35:32 +0000 Subject: Update. 1999-03-30 Ulrich Drepper * time/tzfile.c (__tzfile_read): Process transitions from the rear. Minor optimization. --- time/tzfile.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'time') 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; } -- cgit 1.4.1