aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2025-11-04 09:21:07 -0800
committerPaul Eggert2025-11-04 13:32:58 -0800
commit6ab56a31a52903e78da72e1122a72411a533e682 (patch)
tree92f0ec492ca4c90c1abd9cc413fa96dc5b2cb5af /src
parent59fbaca6b9b48c217c60fc5ab21240ba104059e8 (diff)
downloademacs-6ab56a31a52903e78da72e1122a72411a533e682.tar.gz
emacs-6ab56a31a52903e78da72e1122a72411a533e682.zip
Simplify tzfree use
* src/timefns.c (Fdecode_time, Fencode_time) (Fcurrent_time_string): Do not bother to preserve errno around tzfree calls, as Gnulib now does that for us.
Diffstat (limited to 'src')
-rw-r--r--src/timefns.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/timefns.c b/src/timefns.c
index 75efea3560d..9176659cef1 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -1565,11 +1565,10 @@ usage: (decode-time &optional TIME ZONE FORM) */)
1565 struct tm local_tm, gmt_tm; 1565 struct tm local_tm, gmt_tm;
1566 timezone_t tz = tzlookup (zone, false); 1566 timezone_t tz = tzlookup (zone, false);
1567 struct tm *tm = emacs_localtime_rz (tz, &time_spec, &local_tm); 1567 struct tm *tm = emacs_localtime_rz (tz, &time_spec, &local_tm);
1568 int localtime_errno = errno;
1569 xtzfree (tz); 1568 xtzfree (tz);
1570 1569
1571 if (!tm) 1570 if (!tm)
1572 time_error (localtime_errno); 1571 time_error (errno);
1573 1572
1574 /* Let YEAR = LOCAL_TM.tm_year + TM_YEAR_BASE. */ 1573 /* Let YEAR = LOCAL_TM.tm_year + TM_YEAR_BASE. */
1575 Lisp_Object year; 1574 Lisp_Object year;
@@ -1760,11 +1759,10 @@ usage: (encode-time TIME &rest OBSOLESCENT-ARGUMENTS) */)
1760 timezone_t tz = tzlookup (zone, false); 1759 timezone_t tz = tzlookup (zone, false);
1761 tm.tm_wday = -1; 1760 tm.tm_wday = -1;
1762 time_t value = mktime_z (tz, &tm); 1761 time_t value = mktime_z (tz, &tm);
1763 int mktime_errno = errno;
1764 xtzfree (tz); 1762 xtzfree (tz);
1765 1763
1766 if (tm.tm_wday < 0) 1764 if (tm.tm_wday < 0)
1767 time_error (mktime_errno); 1765 time_error (errno);
1768 1766
1769 if (BASE_EQ (hz, make_fixnum (1))) 1767 if (BASE_EQ (hz, make_fixnum (1)))
1770 return (current_time_list 1768 return (current_time_list
@@ -1875,10 +1873,9 @@ without consideration for daylight saving time. */)
1875 range -999 .. 9999. */ 1873 range -999 .. 9999. */
1876 struct tm tm; 1874 struct tm tm;
1877 struct tm *tmp = emacs_localtime_rz (tz, &value, &tm); 1875 struct tm *tmp = emacs_localtime_rz (tz, &value, &tm);
1878 int localtime_errno = errno;
1879 xtzfree (tz); 1876 xtzfree (tz);
1880 if (! tmp) 1877 if (! tmp)
1881 time_error (localtime_errno); 1878 time_error (errno);
1882 1879
1883 static char const wday_name[][4] = 1880 static char const wday_name[][4] =
1884 { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; 1881 { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };