From: Dmitry Antipov Date: Wed, 14 Jan 2015 10:05:17 +0000 (+0300) Subject: Fix last time zone handling change. X-Git-Tag: emacs-25.0.90~2603^2~7 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=99a1492b8a1269a9a5a280c0510d0ec00114a9a1;p=emacs.git Fix last time zone handling change. * editfns.c (decode_time_zone): Return Lisp string instead. All related users changed. --- 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);