[50/59] Remove use_last label from __tzfile_compute

Message ID 20250105055750.1668721-51-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): Redo last-transition check
so that there is no need for the use_last label or goto.
---
 time/tzfile.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
  

Patch

diff --git a/time/tzfile.c b/time/tzfile.c
index e491df7d9f..8b5faad424 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -614,18 +614,16 @@  __tzfile_compute (__time64_t timer, int use_localtime,
 	}
       else if (timecnt == 0 || timer >= transitions[timecnt - 1])
 	{
-	  if (__glibc_unlikely (tzspec == NULL))
+	  /* TIMER is after the last transition.  Do not use the TZ
+	     string if it is absent or if we cannot convert to the
+	     broken down structure.  */
+	  if (__glibc_unlikely (tzspec == NULL)
+	      || __glibc_unlikely (__offtime (timer, 0, 0, tp) == NULL))
 	    {
-	    use_last:
 	      i = timecnt;
 	      goto found;
 	    }
 
-	  /* Convert to broken down structure.  If this fails do not
-	     use the string.  */
-	  if (__glibc_unlikely (__offtime (timer, 0, 0, tp) == NULL))
-	    goto use_last;
-
 	  /* Use the rules from the TZ string to compute the change.  */
 	  __tz_compute (timer, tp);