[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] parse-datetime no longer depends on nstrftime
From: |
Paul Eggert |
Subject: |
[PATCH] parse-datetime no longer depends on nstrftime |
Date: |
Mon, 16 Sep 2024 11:13:09 -0700 |
I discovered this unnecessary dependency when debugging
GNU Patch.
* lib/parse-datetime.y:
(populate_local_time_zone_table) [!HAVE_STRUCT_TM_TM_ZONE]:
(debug_strfdatetime): Use strftime not nstrftime,
as we don’t need nstrftime’s extensions or bug fixes.
* modules/parse-datetime (Depends-on): Remove nstrftime.
Also remove setenv, unsetenv, timegm, as this module
no longer depends on them directly.
---
ChangeLog | 11 +++++++++++
lib/parse-datetime.y | 13 +++++--------
modules/parse-datetime | 4 ----
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d4f3555e6d..a619271ded 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2024-09-16 Paul Eggert <eggert@cs.ucla.edu>
+ parse-datetime no longer depends on nstrftime
+ I discovered this unnecessary dependency when debugging
+ GNU Patch.
+ * lib/parse-datetime.y:
+ (populate_local_time_zone_table) [!HAVE_STRUCT_TM_TM_ZONE]:
+ (debug_strfdatetime): Use strftime not nstrftime,
+ as we don’t need nstrftime’s extensions or bug fixes.
+ * modules/parse-datetime (Depends-on): Remove nstrftime.
+ Also remove setenv, unsetenv, timegm, as this module
+ no longer depends on them directly.
+
Don’t port July [[...]] changes to C89
Yesterday’s changes to port to C17 and earlier were intrusive,
since they twice replaced one macro with two. Revert the macro
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 665401d422..b036271d01 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -1591,7 +1591,7 @@ populate_local_time_zone_table (parser_control *pc,
struct tm const *tm)
zone = tm->tm_zone;
#else
char *tz_abbr = pc->tz_abbr[first_entry_exists];
- if (nstrftime (tz_abbr, TIME_ZONE_BUFSIZE, "%Z", tm, 0, 0))
+ if (strftime (tz_abbr, TIME_ZONE_BUFSIZE, "%Z", tm))
zone = tz_abbr;
#endif
e->name = zone;
@@ -1613,21 +1613,18 @@ debug_strfdatetime (struct tm const *tm, parser_control
const *pc,
issues with the parsing - better to avoid formats that could
be mis-interpreted (e.g., just YYYY-MM-DD).
- 2. Can strftime be used instead?
- depends if it is portable and can print invalid dates on all systems.
+ 2. Print timezone information ?
- 3. Print timezone information ?
+ 3. Print DST information ?
- 4. Print DST information ?
-
- 5. Print nanosecond information ?
+ 4. Print nanosecond information ?
NOTE:
Printed date/time values might not be valid, e.g., '2016-02-31'
or '2016-19-2016' . These are the values as parsed from the user
string, before validation.
*/
- int m = nstrftime (buf, n, "(Y-M-D) %Y-%m-%d %H:%M:%S", tm, 0, 0);
+ int m = strftime (buf, n, "(Y-M-D) %Y-%m-%d %H:%M:%S", tm);
/* If parser_control information was provided (for timezone),
and there's enough space in the buffer, add timezone info. */
diff --git a/modules/parse-datetime b/modules/parse-datetime
index e8ac3e725d..fc26391aa9 100644
--- a/modules/parse-datetime
+++ b/modules/parse-datetime
@@ -20,14 +20,10 @@ idx
intprops
inttypes
mktime
-nstrftime
-setenv
stdckdint
-unsetenv
time-h
time_r
time_rz
-timegm
configure.ac:
gl_PARSE_DATETIME
--
2.43.0
- [PATCH] parse-datetime no longer depends on nstrftime,
Paul Eggert <=