[04/59] Don't worry about !TZDEFAULT

Message ID 20250105055750.1668721-5-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:56 a.m. UTC
  * time/tzset.c (tzset_internal): Simplify due to the fact that
TZDEFAULT is not a null pointer (tzfile.c is already assuming this).
---
 time/tzset.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/time/tzset.c b/time/tzset.c
index e178742222..1a9a03a436 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -384,17 +384,17 @@  tzset_internal (int always)
 
   /* Save the value of `tz'.  */
   free (old_tz);
-  old_tz = tz ? __strdup (tz) : NULL;
+  old_tz = __strdup (tz);
 
   /* Try to read a data file.  */
   __tzfile_read (tz);
   if (__use_tzfile)
     return;
 
-  /* No data file found.  Default to UTC if nothing specified.  */
+  /* No data file found.  Default to UTC if nothing specified or if
+     TZDEFAULT is broken.  */
 
-  if (tz == NULL || *tz == '\0'
-      || (TZDEFAULT != NULL && strcmp (tz, TZDEFAULT) == 0))
+  if (*tz == '\0' || strcmp (tz, TZDEFAULT) == 0)
     {
       memset (tz_rules, '\0', sizeof tz_rules);
       tz_rules[0].name = tz_rules[1].name = "UTC";