[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 99a1492: Fix last time zone handling change.
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] master 99a1492: Fix last time zone handling change. |
Date: |
Wed, 14 Jan 2015 10:06:57 +0000 |
branch: master
commit 99a1492b8a1269a9a5a280c0510d0ec00114a9a1
Author: Dmitry Antipov <address@hidden>
Commit: Dmitry Antipov <address@hidden>
Fix last time zone handling change.
* editfns.c (decode_time_zone): Return Lisp string instead.
All related users changed.
---
src/editfns.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/editfns.c b/src/editfns.c
index e097893..9a159ba 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2065,15 +2065,13 @@ check_tm_member (Lisp_Object obj, int offset)
/* Decode ZONE as a time zone specification. */
-static const char *
+static Lisp_Object
decode_time_zone (Lisp_Object zone)
{
- const char *tzstring = NULL;
-
if (EQ (zone, Qt))
- tzstring = "UTC0";
+ return build_string ("UTC0");
else if (STRINGP (zone))
- tzstring = SSDATA (zone);
+ return zone;
else if (INTEGERP (zone))
{
static char const tzbuf_format[] = "XXX%s%"pI"d:%02d:%02d";
@@ -2081,13 +2079,11 @@ decode_time_zone (Lisp_Object zone)
EMACS_INT abszone = eabs (XINT (zone)), zone_hr = abszone / (60 * 60);
int zone_min = (abszone / 60) % 60, zone_sec = abszone % 60;
- sprintf (tzbuf, tzbuf_format, &"-"[XINT (zone) < 0],
- zone_hr, zone_min, zone_sec);
- tzstring = tzbuf;
+ return make_formatted_string (tzbuf, tzbuf_format, &"-"[XINT (zone) < 0],
+ zone_hr, zone_min, zone_sec);
}
else
xsignal2 (Qerror, build_string ("Invalid time zone specification"), zone);
- return tzstring;
}
DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0,
@@ -2132,7 +2128,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR
&optional ZONE) */)
value = mktime (&tm);
else
{
- timezone_t tz = tzalloc (decode_time_zone (zone));
+ timezone_t tz = tzalloc (SSDATA (decode_time_zone (zone)));
value = mktime_z (tz, &tm);
tzfree (tz);
}
@@ -2278,7 +2274,7 @@ variable `process-environment', whereas
`set-time-zone-rule' affects
only the former. */)
(Lisp_Object tz)
{
- const char *tzstring = NILP (tz) ? initial_tz : decode_time_zone (tz);
+ const char *tzstring = NILP (tz) ? initial_tz : SSDATA (decode_time_zone
(tz));
block_input ();
set_time_zone_rule (tzstring);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 99a1492: Fix last time zone handling change.,
Dmitry Antipov <=