diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2015-01-14 13:05:17 +0300 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2015-01-14 13:05:17 +0300 |
commit | 99a1492b8a1269a9a5a280c0510d0ec00114a9a1 (patch) | |
tree | 1dea93cd3476c72e7a7d904a6b3c21772951c2ad /src/editfns.c | |
parent | da396beb6e0b9ef9a45afb849eeda26da14038af (diff) | |
download | emacs-99a1492b8a1269a9a5a280c0510d0ec00114a9a1.tar.gz emacs-99a1492b8a1269a9a5a280c0510d0ec00114a9a1.tar.bz2 emacs-99a1492b8a1269a9a5a280c0510d0ec00114a9a1.zip |
Fix last time zone handling change.
* editfns.c (decode_time_zone): Return Lisp string instead.
All related users changed.
Diffstat (limited to 'src/editfns.c')
-rw-r--r-- | src/editfns.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/editfns.c b/src/editfns.c index e097893a6f9..9a159ba6581 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); |