[55/59] Refactor __tzfile_compute index local

Message ID 20250105055750.1668721-56-eggert@cs.ucla.edu (mailing list archive)
State New
Headers
Series time: sync mktime from Gnulib |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Paul Eggert Jan. 5, 2025, 5:57 a.m. UTC
  * time/tzfile.c (__tzfile_compute): Avoid portmanteau index local.
---
 time/tzfile.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Patch

diff --git a/time/tzfile.c b/time/tzfile.c
index 0ee70fd356..bed62d877f 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -643,12 +643,10 @@  __tzfile_compute (__time64_t timer, int use_localtime,
 		  int *leap_correct, bool *leap_hit,
 		  struct tm *tp)
 {
-  tzidx i;
-
   /* Find the last leap second correction transition time before TIMER.  */
   int corr = 0;
   bool hit = false;
-  for (i = leapcnt; 0 < i; )
+  for (tzidx i = leapcnt; 0 < i; )
     {
       i--;
       if (leaps[i].occur <= timer)
@@ -679,7 +677,7 @@  __tzfile_compute (__time64_t timer, int use_localtime,
     }
   else
     {
-      i = first_transition_after (timer);
+      tzidx i = first_transition_after (timer);
       if (i == timecnt)
 	{
 	  /* TIMER is after the last transition, or there are no transitions