diff options
| author | Kenichi Handa | 2012-05-03 15:57:54 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-05-03 15:57:54 +0900 |
| commit | 1f110951b52c0d7705dd5891368efccbce95ec1a (patch) | |
| tree | 5d9683724eb455e9bcb8030fb61114b2e559457b | |
| parent | 2e51d4b5fb960ce0240a0eccbb0ed30cc7f53743 (diff) | |
| parent | 2bd785a208c84e7ae73884d09a1087da52780b4a (diff) | |
| download | emacs-1f110951b52c0d7705dd5891368efccbce95ec1a.tar.gz emacs-1f110951b52c0d7705dd5891368efccbce95ec1a.zip | |
merge trunk
| -rw-r--r-- | ChangeLog | 10 | ||||
| -rwxr-xr-x | autogen/configure | 4 | ||||
| -rw-r--r-- | configure.in | 8 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/custom.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 14 | ||||
| -rw-r--r-- | lisp/subr.el | 29 | ||||
| -rw-r--r-- | src/ChangeLog | 26 | ||||
| -rw-r--r-- | src/buffer.c | 2 | ||||
| -rw-r--r-- | src/editfns.c | 143 | ||||
| -rw-r--r-- | src/intervals.c | 1 |
12 files changed, 153 insertions, 103 deletions
| @@ -1,5 +1,8 @@ | |||
| 1 | 2012-05-02 Glenn Morris <rgm@gnu.org> | 1 | 2012-05-02 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * configure.in (LD_SWITCH_SYSTEM): Don't try to defeat | ||
| 4 | the choices made by FreeBSD and NetBSD. (Bug#10313) | ||
| 5 | |||
| 3 | * Makefile.in (INFO_FILES): Remove variable. | 6 | * Makefile.in (INFO_FILES): Remove variable. |
| 4 | (INFO_NONMISC): New variable. | 7 | (INFO_NONMISC): New variable. |
| 5 | (install-arch-indep, uninstall): Don't use $INFO_FILES. | 8 | (install-arch-indep, uninstall): Don't use $INFO_FILES. |
| @@ -10,13 +13,6 @@ | |||
| 10 | * Makefile.in (install-arch-indep, uninstall): | 13 | * Makefile.in (install-arch-indep, uninstall): |
| 11 | Ensure that INSTALL-type commands are run from top-level. | 14 | Ensure that INSTALL-type commands are run from top-level. |
| 12 | 15 | ||
| 13 | * Makefile.in (INFO_FILES): Add emacs-gnutls; accidentally | ||
| 14 | omitted from 2012-04-12 backport from trunk. | ||
| 15 | |||
| 16 | * info/dir: Make some entries consistent with the source texi files. | ||
| 17 | |||
| 18 | * configure.in (LIBS_TERMCAP): Fix netbsd logic, broken 2012-03-04. | ||
| 19 | |||
| 20 | * info/dir: Make some entries consistent with the source texi files. | 16 | * info/dir: Make some entries consistent with the source texi files. |
| 21 | 17 | ||
| 22 | * configure.in (LIBS_TERMCAP): Fix netbsd logic, broken 2012-03-04. | 18 | * configure.in (LIBS_TERMCAP): Fix netbsd logic, broken 2012-03-04. |
diff --git a/autogen/configure b/autogen/configure index 6e8ddc505fe..5a70efc967f 100755 --- a/autogen/configure +++ b/autogen/configure | |||
| @@ -14939,9 +14939,7 @@ $as_echo "$emacs_cv_freebsd_terminfo" >&6; } | |||
| 14939 | ;; | 14939 | ;; |
| 14940 | 14940 | ||
| 14941 | netbsd) | 14941 | netbsd) |
| 14942 | if test $ac_cv_search_tputs = -lterminfo; then | 14942 | if "x$LIBS_TERMCAP" != "x-lterminfo" ; then |
| 14943 | LIBS_TERMCAP="-lterminfo" | ||
| 14944 | else | ||
| 14945 | TERMINFO=no | 14943 | TERMINFO=no |
| 14946 | LIBS_TERMCAP="-ltermcap" | 14944 | LIBS_TERMCAP="-ltermcap" |
| 14947 | fi | 14945 | fi |
diff --git a/configure.in b/configure.in index c0a12672c62..2bf78e522ec 100644 --- a/configure.in +++ b/configure.in | |||
| @@ -951,7 +951,9 @@ case "$opsys" in | |||
| 951 | ## Let `ld' find image libs and similar things in /usr/local/lib. | 951 | ## Let `ld' find image libs and similar things in /usr/local/lib. |
| 952 | ## The system compiler, GCC, has apparently been modified to not | 952 | ## The system compiler, GCC, has apparently been modified to not |
| 953 | ## look there, contrary to what a stock GCC would do. | 953 | ## look there, contrary to what a stock GCC would do. |
| 954 | LD_SWITCH_SYSTEM=-L/usr/local/lib | 954 | ### It's not our place to do this. See bug#10313#17. |
| 955 | ### LD_SWITCH_SYSTEM=-L/usr/local/lib | ||
| 956 | : | ||
| 955 | ;; | 957 | ;; |
| 956 | 958 | ||
| 957 | gnu-linux) | 959 | gnu-linux) |
| @@ -960,7 +962,9 @@ case "$opsys" in | |||
| 960 | ;; | 962 | ;; |
| 961 | 963 | ||
| 962 | netbsd) | 964 | netbsd) |
| 963 | LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib" | 965 | ### It's not our place to do this. See bug#10313#17. |
| 966 | ### LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib" | ||
| 967 | : | ||
| 964 | ;; | 968 | ;; |
| 965 | 969 | ||
| 966 | openbsd) | 970 | openbsd) |
| @@ -32,6 +32,11 @@ may be useful. | |||
| 32 | --- | 32 | --- |
| 33 | ** Emacs uses libtinfo in preference to libncurses, if available. | 33 | ** Emacs uses libtinfo in preference to libncurses, if available. |
| 34 | 34 | ||
| 35 | --- | ||
| 36 | ** On FreeBSD and NetBSD, configure no longer adds /usr/local/lib and | ||
| 37 | /usr/pkg/lib to the linker search path. You must add them yourself if | ||
| 38 | you want them. | ||
| 39 | |||
| 35 | 40 | ||
| 36 | * Startup Changes in Emacs 24.2 | 41 | * Startup Changes in Emacs 24.2 |
| 37 | 42 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d35f5475bbc..ff2c5a40787 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -4,6 +4,18 @@ | |||
| 4 | decoding, and show a warning message without signalling an error | 4 | decoding, and show a warning message without signalling an error |
| 5 | (Bug#11282). | 5 | (Bug#11282). |
| 6 | 6 | ||
| 7 | 2012-05-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 8 | |||
| 9 | * emacs-lisp/bytecomp.el | ||
| 10 | (byte-compile-file-form-custom-declare-variable): Compile all elements, | ||
| 11 | since cconv.el might have introduced :fun-body, internal-make-closure, | ||
| 12 | and friends for bytecomp to handle (bug#11391). | ||
| 13 | * custom.el (defcustom): Avoid ((λ ..) ..). | ||
| 14 | |||
| 15 | 2012-05-02 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 16 | |||
| 17 | * subr.el (read-passwd): Better clean after ourselves (bug#11392). | ||
| 18 | |||
| 7 | 2012-05-02 Juanma Barranquero <lekktu@gmail.com> | 19 | 2012-05-02 Juanma Barranquero <lekktu@gmail.com> |
| 8 | 20 | ||
| 9 | * notifications.el (dbus-debug): | 21 | * notifications.el (dbus-debug): |
diff --git a/lisp/custom.el b/lisp/custom.el index 611d5688f30..d0eadcc23ff 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -335,7 +335,7 @@ for more information." | |||
| 335 | ;; expression is checked by the byte-compiler, and that | 335 | ;; expression is checked by the byte-compiler, and that |
| 336 | ;; lexical-binding is obeyed, so quote the expression with | 336 | ;; lexical-binding is obeyed, so quote the expression with |
| 337 | ;; `lambda' rather than with `quote'. | 337 | ;; `lambda' rather than with `quote'. |
| 338 | `(list (lambda () ,standard)) | 338 | ``(funcall #',(lambda () ,standard)) |
| 339 | `',standard) | 339 | `',standard) |
| 340 | ,doc | 340 | ,doc |
| 341 | ,@args)) | 341 | ,@args)) |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 93c6518d215..9cb0a376e36 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -2267,19 +2267,7 @@ list that represents a doc string reference. | |||
| 2267 | (when (byte-compile-warning-enabled-p 'callargs) | 2267 | (when (byte-compile-warning-enabled-p 'callargs) |
| 2268 | (byte-compile-nogroup-warn form)) | 2268 | (byte-compile-nogroup-warn form)) |
| 2269 | (push (nth 1 (nth 1 form)) byte-compile-bound-variables) | 2269 | (push (nth 1 (nth 1 form)) byte-compile-bound-variables) |
| 2270 | ;; Don't compile the expression because it may be displayed to the user. | 2270 | (byte-compile-keep-pending form)) |
| 2271 | ;; (when (eq (car-safe (nth 2 form)) 'quote) | ||
| 2272 | ;; ;; (nth 2 form) is meant to evaluate to an expression, so if we have the | ||
| 2273 | ;; ;; final value already, we can byte-compile it. | ||
| 2274 | ;; (setcar (cdr (nth 2 form)) | ||
| 2275 | ;; (byte-compile-top-level (cadr (nth 2 form)) nil 'file))) | ||
| 2276 | (let ((tail (nthcdr 4 form))) | ||
| 2277 | (while tail | ||
| 2278 | (unless (keywordp (car tail)) ;No point optimizing keywords. | ||
| 2279 | ;; Compile the keyword arguments. | ||
| 2280 | (setcar tail (byte-compile-top-level (car tail) nil 'file))) | ||
| 2281 | (setq tail (cdr tail)))) | ||
| 2282 | form) | ||
| 2283 | 2271 | ||
| 2284 | (put 'require 'byte-hunk-handler 'byte-compile-file-form-require) | 2272 | (put 'require 'byte-hunk-handler 'byte-compile-file-form-require) |
| 2285 | (defun byte-compile-file-form-require (form) | 2273 | (defun byte-compile-file-form-require (form) |
diff --git a/lisp/subr.el b/lisp/subr.el index b548f82ca5a..1f9f3aee9fa 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2115,21 +2115,21 @@ by doing (clear-string STRING)." | |||
| 2115 | (message "Password not repeated accurately; please start over") | 2115 | (message "Password not repeated accurately; please start over") |
| 2116 | (sit-for 1)))) | 2116 | (sit-for 1)))) |
| 2117 | success) | 2117 | success) |
| 2118 | (let (minibuf) | 2118 | (let ((hide-chars-fun |
| 2119 | (lambda (beg end _len) | ||
| 2120 | (clear-this-command-keys) | ||
| 2121 | (setq beg (min end (max (minibuffer-prompt-end) | ||
| 2122 | beg))) | ||
| 2123 | (dotimes (i (- end beg)) | ||
| 2124 | (put-text-property (+ i beg) (+ 1 i beg) | ||
| 2125 | 'display (string ?.))))) | ||
| 2126 | minibuf) | ||
| 2119 | (minibuffer-with-setup-hook | 2127 | (minibuffer-with-setup-hook |
| 2120 | (lambda () | 2128 | (lambda () |
| 2121 | (setq minibuf (current-buffer)) | 2129 | (setq minibuf (current-buffer)) |
| 2122 | ;; Turn off electricity. | 2130 | ;; Turn off electricity. |
| 2123 | (set (make-local-variable 'post-self-insert-hook) nil) | 2131 | (set (make-local-variable 'post-self-insert-hook) nil) |
| 2124 | (add-hook 'after-change-functions | 2132 | (add-hook 'after-change-functions hide-chars-fun nil 'local)) |
| 2125 | (lambda (beg end _len) | ||
| 2126 | (clear-this-command-keys) | ||
| 2127 | (setq beg (min end (max (minibuffer-prompt-end) | ||
| 2128 | beg))) | ||
| 2129 | (dotimes (i (- end beg)) | ||
| 2130 | (put-text-property (+ i beg) (+ 1 i beg) | ||
| 2131 | 'display (string ?.)))) | ||
| 2132 | nil t)) | ||
| 2133 | (unwind-protect | 2133 | (unwind-protect |
| 2134 | (read-string prompt nil | 2134 | (read-string prompt nil |
| 2135 | (let ((sym (make-symbol "forget-history"))) | 2135 | (let ((sym (make-symbol "forget-history"))) |
| @@ -2137,7 +2137,14 @@ by doing (clear-string STRING)." | |||
| 2137 | sym) | 2137 | sym) |
| 2138 | default) | 2138 | default) |
| 2139 | (when (buffer-live-p minibuf) | 2139 | (when (buffer-live-p minibuf) |
| 2140 | (with-current-buffer minibuf (erase-buffer)))))))) | 2140 | (with-current-buffer minibuf |
| 2141 | ;; Not sure why but it seems that there might be cases where the | ||
| 2142 | ;; minibuffer is not always properly reset later on, so undo | ||
| 2143 | ;; whatever we've done here (bug#11392). | ||
| 2144 | (remove-hook 'after-change-functions hide-chars-fun 'local) | ||
| 2145 | (kill-local-variable 'post-self-insert-hook) | ||
| 2146 | ;; And of course, don't keep the sensitive data around. | ||
| 2147 | (erase-buffer)))))))) | ||
| 2141 | 2148 | ||
| 2142 | ;; This should be used by `call-interactively' for `n' specs. | 2149 | ;; This should be used by `call-interactively' for `n' specs. |
| 2143 | (defun read-number (prompt &optional default) | 2150 | (defun read-number (prompt &optional default) |
diff --git a/src/ChangeLog b/src/ChangeLog index d621dcc8859..bf297616e82 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,29 @@ | |||
| 1 | 2012-05-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix race conditions involving setenv, gmtime, localtime, asctime. | ||
| 4 | Without this fix, interrupts could mess up code that uses these | ||
| 5 | nonreentrant functions, since setting TZ invalidates existing | ||
| 6 | tm_zone or tzname values, and since most of these functions return | ||
| 7 | pointers to static storage. | ||
| 8 | * editfns.c (format_time_string, Fdecode_time, Fencode_time) | ||
| 9 | (Fcurrent_time_string, Fcurrent_time_zone, Fset_time_zone_rule): | ||
| 10 | Grow the critical sections to include not just invoking | ||
| 11 | localtime/gmtime, but also accessing these functions' results | ||
| 12 | including their tm_zone values if any, and any related TZ setting. | ||
| 13 | (format_time_string): Last arg is now struct tm *, not struct tm **, | ||
| 14 | so that the struct tm is saved in the critical section. All | ||
| 15 | callers changed. Simplify allocation of initial buffer, partly | ||
| 16 | motivated by the fact that memory allocation needs to be outside | ||
| 17 | the critical section. | ||
| 18 | |||
| 19 | 2012-05-02 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 20 | |||
| 21 | * intervals.c (adjust_intervals_for_insertion): Initialize `newi' | ||
| 22 | with RESET_INTERVAL. | ||
| 23 | |||
| 24 | * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): | ||
| 25 | Remove duplicated buffer name initialization. | ||
| 26 | |||
| 1 | 2012-05-02 Jim Meyering <jim@meyering.net> | 27 | 2012-05-02 Jim Meyering <jim@meyering.net> |
| 2 | 28 | ||
| 3 | * xterm.c (x_term_init): Use memcpy instead of strncpy (Bug#11373). | 29 | * xterm.c (x_term_init): Use memcpy instead of strncpy (Bug#11373). |
diff --git a/src/buffer.c b/src/buffer.c index 9bac3ec742b..2ddbc699481 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -392,7 +392,6 @@ even if it is dead. The return value is never nil. */) | |||
| 392 | 392 | ||
| 393 | BVAR (b, mark) = Fmake_marker (); | 393 | BVAR (b, mark) = Fmake_marker (); |
| 394 | BUF_MARKERS (b) = NULL; | 394 | BUF_MARKERS (b) = NULL; |
| 395 | BVAR (b, name) = name; | ||
| 396 | 395 | ||
| 397 | /* Put this in the alist of all live buffers. */ | 396 | /* Put this in the alist of all live buffers. */ |
| 398 | XSETBUFFER (buffer, b); | 397 | XSETBUFFER (buffer, b); |
| @@ -612,7 +611,6 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 612 | Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); | 611 | Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); |
| 613 | 612 | ||
| 614 | BVAR (b, mark) = Fmake_marker (); | 613 | BVAR (b, mark) = Fmake_marker (); |
| 615 | BVAR (b, name) = name; | ||
| 616 | 614 | ||
| 617 | /* The multibyte status belongs to the base buffer. */ | 615 | /* The multibyte status belongs to the base buffer. */ |
| 618 | BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters); | 616 | BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters); |
diff --git a/src/editfns.c b/src/editfns.c index a41565d8588..b52bc0c2a99 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -86,7 +86,7 @@ extern Lisp_Object w32_get_internal_run_time (void); | |||
| 86 | 86 | ||
| 87 | static void time_overflow (void) NO_RETURN; | 87 | static void time_overflow (void) NO_RETURN; |
| 88 | static Lisp_Object format_time_string (char const *, ptrdiff_t, Lisp_Object, | 88 | static Lisp_Object format_time_string (char const *, ptrdiff_t, Lisp_Object, |
| 89 | int, time_t *, struct tm **); | 89 | int, time_t *, struct tm *); |
| 90 | static int tm_diff (struct tm *, struct tm *); | 90 | static int tm_diff (struct tm *, struct tm *); |
| 91 | static void update_buffer_properties (EMACS_INT, EMACS_INT); | 91 | static void update_buffer_properties (EMACS_INT, EMACS_INT); |
| 92 | 92 | ||
| @@ -1704,7 +1704,7 @@ usage: (format-time-string FORMAT-STRING &optional TIME UNIVERSAL) */) | |||
| 1704 | (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal) | 1704 | (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal) |
| 1705 | { | 1705 | { |
| 1706 | time_t t; | 1706 | time_t t; |
| 1707 | struct tm *tm; | 1707 | struct tm tm; |
| 1708 | 1708 | ||
| 1709 | CHECK_STRING (format_string); | 1709 | CHECK_STRING (format_string); |
| 1710 | format_string = code_convert_string_norecord (format_string, | 1710 | format_string = code_convert_string_norecord (format_string, |
| @@ -1715,54 +1715,55 @@ usage: (format-time-string FORMAT-STRING &optional TIME UNIVERSAL) */) | |||
| 1715 | 1715 | ||
| 1716 | static Lisp_Object | 1716 | static Lisp_Object |
| 1717 | format_time_string (char const *format, ptrdiff_t formatlen, | 1717 | format_time_string (char const *format, ptrdiff_t formatlen, |
| 1718 | Lisp_Object timeval, int ut, time_t *tval, struct tm **tmp) | 1718 | Lisp_Object timeval, int ut, time_t *tval, struct tm *tmp) |
| 1719 | { | 1719 | { |
| 1720 | ptrdiff_t size; | 1720 | char buffer[4000]; |
| 1721 | char *buf = buffer; | ||
| 1722 | size_t size = sizeof buffer; | ||
| 1723 | size_t len; | ||
| 1724 | Lisp_Object bufstring; | ||
| 1721 | int usec; | 1725 | int usec; |
| 1722 | int ns; | 1726 | int ns; |
| 1723 | struct tm *tm; | 1727 | struct tm *tm; |
| 1728 | USE_SAFE_ALLOCA; | ||
| 1724 | 1729 | ||
| 1725 | if (! (lisp_time_argument (timeval, tval, &usec) | 1730 | if (! (lisp_time_argument (timeval, tval, &usec) |
| 1726 | && 0 <= usec && usec < 1000000)) | 1731 | && 0 <= usec && usec < 1000000)) |
| 1727 | error ("Invalid time specification"); | 1732 | error ("Invalid time specification"); |
| 1728 | ns = usec * 1000; | 1733 | ns = usec * 1000; |
| 1729 | 1734 | ||
| 1730 | /* This is probably enough. */ | ||
| 1731 | size = formatlen; | ||
| 1732 | if (size <= (STRING_BYTES_BOUND - 50) / 6) | ||
| 1733 | size = size * 6 + 50; | ||
| 1734 | |||
| 1735 | BLOCK_INPUT; | ||
| 1736 | tm = ut ? gmtime (tval) : localtime (tval); | ||
| 1737 | UNBLOCK_INPUT; | ||
| 1738 | if (! tm) | ||
| 1739 | time_overflow (); | ||
| 1740 | *tmp = tm; | ||
| 1741 | |||
| 1742 | synchronize_system_time_locale (); | ||
| 1743 | |||
| 1744 | while (1) | 1735 | while (1) |
| 1745 | { | 1736 | { |
| 1746 | char *buf = (char *) alloca (size + 1); | 1737 | BLOCK_INPUT; |
| 1747 | size_t result; | 1738 | |
| 1739 | synchronize_system_time_locale (); | ||
| 1740 | |||
| 1741 | tm = ut ? gmtime (tval) : localtime (tval); | ||
| 1742 | if (! tm) | ||
| 1743 | { | ||
| 1744 | UNBLOCK_INPUT; | ||
| 1745 | time_overflow (); | ||
| 1746 | } | ||
| 1747 | *tmp = *tm; | ||
| 1748 | 1748 | ||
| 1749 | buf[0] = '\1'; | 1749 | buf[0] = '\1'; |
| 1750 | BLOCK_INPUT; | 1750 | len = emacs_nmemftime (buf, size, format, formatlen, tm, ut, ns); |
| 1751 | result = emacs_nmemftime (buf, size, format, formatlen, tm, ut, ns); | 1751 | if ((0 < len && len < size) || (len == 0 && buf[0] == '\0')) |
| 1752 | UNBLOCK_INPUT; | 1752 | break; |
| 1753 | if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0')) | ||
| 1754 | return code_convert_string_norecord (make_unibyte_string (buf, result), | ||
| 1755 | Vlocale_coding_system, 0); | ||
| 1756 | 1753 | ||
| 1757 | /* If buffer was too small, make it bigger and try again. */ | 1754 | /* Buffer was too small, so make it bigger and try again. */ |
| 1758 | BLOCK_INPUT; | 1755 | len = emacs_nmemftime (NULL, SIZE_MAX, format, formatlen, tm, ut, ns); |
| 1759 | result = emacs_nmemftime (NULL, (size_t) -1, format, formatlen, | ||
| 1760 | tm, ut, ns); | ||
| 1761 | UNBLOCK_INPUT; | 1756 | UNBLOCK_INPUT; |
| 1762 | if (STRING_BYTES_BOUND <= result) | 1757 | if (STRING_BYTES_BOUND <= len) |
| 1763 | string_overflow (); | 1758 | string_overflow (); |
| 1764 | size = result + 1; | 1759 | size = len + 1; |
| 1760 | SAFE_ALLOCA (buf, char *, size); | ||
| 1765 | } | 1761 | } |
| 1762 | |||
| 1763 | UNBLOCK_INPUT; | ||
| 1764 | bufstring = make_unibyte_string (buf, len); | ||
| 1765 | SAFE_FREE (); | ||
| 1766 | return code_convert_string_norecord (bufstring, Vlocale_coding_system, 0); | ||
| 1766 | } | 1767 | } |
| 1767 | 1768 | ||
| 1768 | DEFUN ("decode-time", Fdecode_time, Sdecode_time, 0, 1, 0, | 1769 | DEFUN ("decode-time", Fdecode_time, Sdecode_time, 0, 1, 0, |
| @@ -1792,31 +1793,32 @@ DOW and ZONE.) */) | |||
| 1792 | 1793 | ||
| 1793 | BLOCK_INPUT; | 1794 | BLOCK_INPUT; |
| 1794 | decoded_time = localtime (&time_spec); | 1795 | decoded_time = localtime (&time_spec); |
| 1796 | /* Make a copy, in case a signal handler modifies TZ or the struct. */ | ||
| 1797 | if (decoded_time) | ||
| 1798 | save_tm = *decoded_time; | ||
| 1795 | UNBLOCK_INPUT; | 1799 | UNBLOCK_INPUT; |
| 1796 | if (! (decoded_time | 1800 | if (! (decoded_time |
| 1797 | && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= decoded_time->tm_year | 1801 | && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= save_tm.tm_year |
| 1798 | && decoded_time->tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) | 1802 | && save_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) |
| 1799 | time_overflow (); | 1803 | time_overflow (); |
| 1800 | XSETFASTINT (list_args[0], decoded_time->tm_sec); | 1804 | XSETFASTINT (list_args[0], save_tm.tm_sec); |
| 1801 | XSETFASTINT (list_args[1], decoded_time->tm_min); | 1805 | XSETFASTINT (list_args[1], save_tm.tm_min); |
| 1802 | XSETFASTINT (list_args[2], decoded_time->tm_hour); | 1806 | XSETFASTINT (list_args[2], save_tm.tm_hour); |
| 1803 | XSETFASTINT (list_args[3], decoded_time->tm_mday); | 1807 | XSETFASTINT (list_args[3], save_tm.tm_mday); |
| 1804 | XSETFASTINT (list_args[4], decoded_time->tm_mon + 1); | 1808 | XSETFASTINT (list_args[4], save_tm.tm_mon + 1); |
| 1805 | /* On 64-bit machines an int is narrower than EMACS_INT, thus the | 1809 | /* On 64-bit machines an int is narrower than EMACS_INT, thus the |
| 1806 | cast below avoids overflow in int arithmetics. */ | 1810 | cast below avoids overflow in int arithmetics. */ |
| 1807 | XSETINT (list_args[5], TM_YEAR_BASE + (EMACS_INT) decoded_time->tm_year); | 1811 | XSETINT (list_args[5], TM_YEAR_BASE + (EMACS_INT) save_tm.tm_year); |
| 1808 | XSETFASTINT (list_args[6], decoded_time->tm_wday); | 1812 | XSETFASTINT (list_args[6], save_tm.tm_wday); |
| 1809 | list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil; | 1813 | list_args[7] = save_tm.tm_isdst ? Qt : Qnil; |
| 1810 | 1814 | ||
| 1811 | /* Make a copy, in case gmtime modifies the struct. */ | ||
| 1812 | save_tm = *decoded_time; | ||
| 1813 | BLOCK_INPUT; | 1815 | BLOCK_INPUT; |
| 1814 | decoded_time = gmtime (&time_spec); | 1816 | decoded_time = gmtime (&time_spec); |
| 1815 | UNBLOCK_INPUT; | ||
| 1816 | if (decoded_time == 0) | 1817 | if (decoded_time == 0) |
| 1817 | list_args[8] = Qnil; | 1818 | list_args[8] = Qnil; |
| 1818 | else | 1819 | else |
| 1819 | XSETINT (list_args[8], tm_diff (&save_tm, decoded_time)); | 1820 | XSETINT (list_args[8], tm_diff (&save_tm, decoded_time)); |
| 1821 | UNBLOCK_INPUT; | ||
| 1820 | return Flist (9, list_args); | 1822 | return Flist (9, list_args); |
| 1821 | } | 1823 | } |
| 1822 | 1824 | ||
| @@ -1898,21 +1900,23 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1898 | else | 1900 | else |
| 1899 | error ("Invalid time zone specification"); | 1901 | error ("Invalid time zone specification"); |
| 1900 | 1902 | ||
| 1903 | BLOCK_INPUT; | ||
| 1904 | |||
| 1901 | /* Set TZ before calling mktime; merely adjusting mktime's returned | 1905 | /* Set TZ before calling mktime; merely adjusting mktime's returned |
| 1902 | value doesn't suffice, since that would mishandle leap seconds. */ | 1906 | value doesn't suffice, since that would mishandle leap seconds. */ |
| 1903 | set_time_zone_rule (tzstring); | 1907 | set_time_zone_rule (tzstring); |
| 1904 | 1908 | ||
| 1905 | BLOCK_INPUT; | ||
| 1906 | value = mktime (&tm); | 1909 | value = mktime (&tm); |
| 1907 | UNBLOCK_INPUT; | ||
| 1908 | 1910 | ||
| 1909 | /* Restore TZ to previous value. */ | 1911 | /* Restore TZ to previous value. */ |
| 1910 | newenv = environ; | 1912 | newenv = environ; |
| 1911 | environ = oldenv; | 1913 | environ = oldenv; |
| 1912 | xfree (newenv); | ||
| 1913 | #ifdef LOCALTIME_CACHE | 1914 | #ifdef LOCALTIME_CACHE |
| 1914 | tzset (); | 1915 | tzset (); |
| 1915 | #endif | 1916 | #endif |
| 1917 | UNBLOCK_INPUT; | ||
| 1918 | |||
| 1919 | xfree (newenv); | ||
| 1916 | } | 1920 | } |
| 1917 | 1921 | ||
| 1918 | if (value == (time_t) -1) | 1922 | if (value == (time_t) -1) |
| @@ -1939,24 +1943,29 @@ but this is considered obsolete. */) | |||
| 1939 | { | 1943 | { |
| 1940 | time_t value; | 1944 | time_t value; |
| 1941 | struct tm *tm; | 1945 | struct tm *tm; |
| 1942 | register char *tem; | 1946 | char *tem = NULL; |
| 1947 | char buf[sizeof "Mon Apr 30 12:49:17 2012" - 1]; | ||
| 1943 | 1948 | ||
| 1944 | if (! lisp_time_argument (specified_time, &value, NULL)) | 1949 | if (! lisp_time_argument (specified_time, &value, NULL)) |
| 1945 | error ("Invalid time specification"); | 1950 | error ("Invalid time specification"); |
| 1946 | 1951 | ||
| 1947 | /* Convert to a string, checking for out-of-range time stamps. | 1952 | /* Convert to a string, checking for out-of-range time stamps. |
| 1953 | Omit the trailing newline. | ||
| 1948 | Don't use 'ctime', as that might dump core if VALUE is out of | 1954 | Don't use 'ctime', as that might dump core if VALUE is out of |
| 1949 | range. */ | 1955 | range. */ |
| 1950 | BLOCK_INPUT; | 1956 | BLOCK_INPUT; |
| 1951 | tm = localtime (&value); | 1957 | tm = localtime (&value); |
| 1958 | if (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year)) | ||
| 1959 | { | ||
| 1960 | tem = asctime (tm); | ||
| 1961 | if (tem) | ||
| 1962 | memcpy (buf, tem, sizeof buf); | ||
| 1963 | } | ||
| 1952 | UNBLOCK_INPUT; | 1964 | UNBLOCK_INPUT; |
| 1953 | if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm)))) | 1965 | if (! tem) |
| 1954 | time_overflow (); | 1966 | time_overflow (); |
| 1955 | 1967 | ||
| 1956 | /* Remove the trailing newline. */ | 1968 | return make_unibyte_string (buf, sizeof buf); |
| 1957 | tem[strlen (tem) - 1] = '\0'; | ||
| 1958 | |||
| 1959 | return build_string (tem); | ||
| 1960 | } | 1969 | } |
| 1961 | 1970 | ||
| 1962 | /* Yield A - B, measured in seconds. | 1971 | /* Yield A - B, measured in seconds. |
| @@ -2000,22 +2009,22 @@ the data it can't find. */) | |||
| 2000 | (Lisp_Object specified_time) | 2009 | (Lisp_Object specified_time) |
| 2001 | { | 2010 | { |
| 2002 | time_t value; | 2011 | time_t value; |
| 2012 | int offset; | ||
| 2003 | struct tm *t; | 2013 | struct tm *t; |
| 2004 | struct tm localtm; | 2014 | struct tm localtm; |
| 2005 | struct tm *localt; | ||
| 2006 | Lisp_Object zone_offset, zone_name; | 2015 | Lisp_Object zone_offset, zone_name; |
| 2007 | 2016 | ||
| 2008 | zone_offset = Qnil; | 2017 | zone_offset = Qnil; |
| 2009 | zone_name = format_time_string ("%Z", sizeof "%Z" - 1, specified_time, | 2018 | zone_name = format_time_string ("%Z", sizeof "%Z" - 1, specified_time, |
| 2010 | 0, &value, &localt); | 2019 | 0, &value, &localtm); |
| 2011 | localtm = *localt; | ||
| 2012 | BLOCK_INPUT; | 2020 | BLOCK_INPUT; |
| 2013 | t = gmtime (&value); | 2021 | t = gmtime (&value); |
| 2022 | if (t) | ||
| 2023 | offset = tm_diff (&localtm, t); | ||
| 2014 | UNBLOCK_INPUT; | 2024 | UNBLOCK_INPUT; |
| 2015 | 2025 | ||
| 2016 | if (t) | 2026 | if (t) |
| 2017 | { | 2027 | { |
| 2018 | int offset = tm_diff (&localtm, t); | ||
| 2019 | zone_offset = make_number (offset); | 2028 | zone_offset = make_number (offset); |
| 2020 | if (SCHARS (zone_name) == 0) | 2029 | if (SCHARS (zone_name) == 0) |
| 2021 | { | 2030 | { |
| @@ -2053,9 +2062,16 @@ only the former. */) | |||
| 2053 | (Lisp_Object tz) | 2062 | (Lisp_Object tz) |
| 2054 | { | 2063 | { |
| 2055 | const char *tzstring; | 2064 | const char *tzstring; |
| 2065 | char **old_environbuf; | ||
| 2066 | |||
| 2067 | if (! (NILP (tz) || EQ (tz, Qt))) | ||
| 2068 | CHECK_STRING (tz); | ||
| 2069 | |||
| 2070 | BLOCK_INPUT; | ||
| 2056 | 2071 | ||
| 2057 | /* When called for the first time, save the original TZ. */ | 2072 | /* When called for the first time, save the original TZ. */ |
| 2058 | if (!environbuf) | 2073 | old_environbuf = environbuf; |
| 2074 | if (!old_environbuf) | ||
| 2059 | initial_tz = (char *) getenv ("TZ"); | 2075 | initial_tz = (char *) getenv ("TZ"); |
| 2060 | 2076 | ||
| 2061 | if (NILP (tz)) | 2077 | if (NILP (tz)) |
| @@ -2063,15 +2079,14 @@ only the former. */) | |||
| 2063 | else if (EQ (tz, Qt)) | 2079 | else if (EQ (tz, Qt)) |
| 2064 | tzstring = "UTC0"; | 2080 | tzstring = "UTC0"; |
| 2065 | else | 2081 | else |
| 2066 | { | 2082 | tzstring = SSDATA (tz); |
| 2067 | CHECK_STRING (tz); | ||
| 2068 | tzstring = SSDATA (tz); | ||
| 2069 | } | ||
| 2070 | 2083 | ||
| 2071 | set_time_zone_rule (tzstring); | 2084 | set_time_zone_rule (tzstring); |
| 2072 | xfree (environbuf); | ||
| 2073 | environbuf = environ; | 2085 | environbuf = environ; |
| 2074 | 2086 | ||
| 2087 | UNBLOCK_INPUT; | ||
| 2088 | |||
| 2089 | xfree (old_environbuf); | ||
| 2075 | return Qnil; | 2090 | return Qnil; |
| 2076 | } | 2091 | } |
| 2077 | 2092 | ||
diff --git a/src/intervals.c b/src/intervals.c index 88f47f58b52..a750ccd13f7 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -1000,6 +1000,7 @@ adjust_intervals_for_insertion (INTERVAL tree, | |||
| 1000 | Lisp_Object pleft, pright; | 1000 | Lisp_Object pleft, pright; |
| 1001 | struct interval newi; | 1001 | struct interval newi; |
| 1002 | 1002 | ||
| 1003 | RESET_INTERVAL (&newi); | ||
| 1003 | pleft = NULL_INTERVAL_P (prev) ? Qnil : prev->plist; | 1004 | pleft = NULL_INTERVAL_P (prev) ? Qnil : prev->plist; |
| 1004 | pright = NULL_INTERVAL_P (i) ? Qnil : i->plist; | 1005 | pright = NULL_INTERVAL_P (i) ? Qnil : i->plist; |
| 1005 | newi.plist = merge_properties_sticky (pleft, pright); | 1006 | newi.plist = merge_properties_sticky (pleft, pright); |