+2013-01-19 Eli Zaretskii <eliz@gnu.org>
+
+ * editfns.c (get_pos_property): Use SAFE_ALLOCA_LISP, to avoid
+ segfault when there are lots of overlays.
+
+ * buffer.c (sort_overlays): Use SAFE_NALLOCA, to avoid segfault
+ when there are lots of overlays. See
+ http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00421.html
+ for the details and a way to reproduce.
+
+2013-01-19 Paul Eggert <eggert@cs.ucla.edu>
+
+ * fileio.c: Use O_APPEND to append.
+ This corresponds better to the natural interpretation of "append",
+ and avoids the need to open the output file twice, or to invoke
+ lseek when APPEND is neither nil nor a number.
+ This relies on POSIX 1003.1-1988 or later, which is OK nowadays.
+ (Fwrite_region): Simplify. Use O_APPEND instead of opening the
+ file possibly twice, and lseeking to its end; this avoids the
+ need to lseek on non-regular files. Do not use O_EXCL and O_TRUNC
+ at the same time: the combination is never needed and apparently
+ it doesn't work with DOS_NT.
+
+ Fix size bug on DOS_NT introduced by CIFS workaround (Bug#13149).
+ * fileio.c (Fwrite_region): Use O_BINARY in checking code, too.
+
+ Allow floating-point file offsets.
+ Problem reported by Vitalie Spinu in
+ <http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00411.html>.
+ * fileio.c (emacs_lseek): Remove.
+ (file_offset): New function.
+ (Finsert_file_contents, Fwrite_region): Use it.
+
+2013-01-19 Chong Yidong <cyd@gnu.org>
+
+ * emacs.c (Fkill_emacs): Set waiting_for_input to 0 to avoid
+ aborting on Fsignal (Bug#13289).
+
+2013-01-19 Eli Zaretskii <eliz@gnu.org>
+
+ * w32.c (acl_set_file): Treat ERROR_ACCESS_DENIED from
+ set_file_security as failure due to insufficient privileges.
+ Reported by Fabrice Popineau <fabrice.popineau@supelec.fr>.
+ (fstat): Return owner and group like 'stat' and 'lstat' do.
+
+2013-01-19 Paul Eggert <eggert@cs.ucla.edu>
+
+ Work around bug in CIFS and vboxsf file systems (Bug#13149).
+ The bug was observed on Ubuntu operating inside a virtual machine,
+ editing files mounted via CIFS or vboxsf from the MS Windows 7 host.
+ The workaround introduces a race condition on non-buggy hosts,
+ but it's an unlikely race and anyway there's a nearly identical
+ nearby race that can't be fixed.
+ * fileio.c (valid_timestamp_file_system, timestamp_file_system):
+ New static vars.
+ (Fwrite_region): Test for file system time stamp bug.
+ (init_fileio): New function.
+ * lisp.h (init_fileio): Declare it.
+ * emacs.c (main): Call it.
+
+ * fileio.c (Finsert_file_contents): Simplify new diagnostic
+ and make it more consistent with other stat-failure diagnostics.
+
+2013-01-18 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Fix crash when inserting data from non-regular files. See
+ http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00406.html
+ for the error description produced by valgrind.
+ * fileio.c (read_non_regular): Rename to read_contents.
+ Free Lisp_Save_Value object used to pass parameters.
+ (read_non_regular_quit): Rename to read_contents_quit.
+ (Finsert_file_contents): Redesign internal file reading loop to adjust
+ gap and end positions after each read and so help make_gap to work
+ properly. Do not signal an I/O error too early and so do not leave
+ not yet decoded characters in a buffer, which was the reason of
+ redisplay crash. Use list2 to build return value. Adjust comments.
+
+2013-01-17 Paul Eggert <eggert@cs.ucla.edu>
+
+ Close a race when statting and reading files (Bug#13149).
+ * fileio.c (Finsert_file_contents): Use open+fstat, not stat+open.
+ This avoids a race if the file is renamed between stat and open.
+ This race is not the problem originally noted in Bug#13149;
+ see <http://bugs.gnu.org/13149#73> and later messages in the thread.
+
+2013-01-17 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * lisp.h (toplevel): Add comment about using Lisp_Save_Value
+ objects, related functions and macros.
+ (make_save_value): Adjust prototype.
+ (make_save_pointer): New prototype.
+ (SAFE_NALLOCA): Fix indentation. Use make_save_pointer.
+ (SAFE_ALLOCA_LISP): Adjust make_save_value usage.
+ * alloc.c (format_save_value): Rename to make_save_value.
+ (make_save_pointer): New function.
+ (record_xmalloc): Use make_save_pointer.
+ * dired.c, editfns.c, fileio.c, font.c, gtkutil.c, lread.c:
+ * nsmenu.m, nsterm.m, xfns.c, xmenu.c, xselect.c, keymap.c:
+ Change users of make_save_value to make_save_pointer.
+ Likewise for format_save_value and make_save_value.
+
+2013-01-17 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * buffer.h (NARROWED, BUF_NARROWED): Drop unused macros.
+ (DECODE_POSITION, BUFFER_CHECK_INDIRECTION): Fix indentation.
+ * buffer.c (toplevel, syms_of_buffer): Drop old commented-out
+ debugging stubs.
+
+2013-01-15 Paul Eggert <eggert@cs.ucla.edu>
+
+ * alloc.c (free_save_value): Now static.
+
+2013-01-15 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * keymap.c (map_keymap_internal): Use format_save_value.
+ (map_keymap_char_table_item): Adjust accordingly.
+ * fileio.c (non_regular_fd, non_regular_inserted)
+ (non_regular_nbytes): Remove.
+ (Finsert_file_contents): Convert trytry to ptrdiff_t. Use
+ format_save_value to pass parameters to read_non_regular.
+ (read_non_regular): Use XSAVE_ macros to extract parameters.
+ Adjust comment.
+ * xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Use
+ format_save_value.
+ (pop_down_menu) [!USE_X_TOOLKIT && !USE_GTK]: Adjust user.
+
+2013-01-15 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * lisp.h (XSAVE_POINTER, XSAVE_INTEGER): Change to allow
+ extraction from any Lisp_Save_Value slot. Add type checking.
+ * alloc.c, dired.c, editfns.c, fileio.c, ftfont.c, gtkutil.c:
+ * keymap.c, lread.c, nsterm.h, nsmenu.c, xfns.c, xmenu.c:
+ * xselect.c: All users changed.
+
+2013-01-15 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Some convenient bits to deal with Lisp_Save_Values.
+ * lisp.h (XSAVE_OBJECT): New macro to extract saved objects.
+ (allocate_misc): Remove prototype.
+ (format_save_value): New prototype.
+ * alloc.c (allocate_misc): Revert back to static.
+ (format_save_value): New function to build Lisp_Save_Value
+ object with the specified internal structure.
+ (make_save_value): Reimplement using format_save_value.
+ * editfns.c (save_excursion_save): Use format_save_value.
+ (save_excursion_restore): Use XSAVE_OBJECT.
+
+2013-01-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ Avoid needless casts with XSAVE_POINTER.
+ * alloc.c (mark_object) [GC_MARK_STACK]:
+ * dired.c (directory_files_internal_unwind):
+ * fileio.c (do_auto_save_unwind):
+ * gtkutil.c (pop_down_dialog):
+ * keymap.c (map_keymap_char_table_item):
+ * lread.c (load_unwind):
+ * nsmenu.m (pop_down_menu):
+ * print.c (print_object) [GC_MARK_STACK]:
+ * xfns.c (clean_up_file_dialog):
+ * xmenu.c (cleanup_widget_value_tree):
+ Omit casts between XSAVE_POINTER and a pointer type.
+
+2013-01-14 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Fix compilation with GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE.
+ * eval.c (eval_sub): Protect `form' from being GCed before its
+ car and cdr becomes protected with the backtrace entry.
+
+2013-01-14 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Make Lisp_Save_Value more versatile storage for up to four objects.
+ * lisp.h (toplevel): Enumeration to describe types of saved objects.
+ (struct Lisp_Save_Value): New layout. Adjust comments.
+ (XSAVE_POINTER): New macro.
+ (XSAVE_INTEGER): Likewise.
+ (allocate_misc): Add prototype.
+ (free_misc): Likewise.
+ * alloc.c (allocate_misc): Now global.
+ (free_misc): Likewise. Adjust comment.
+ (make_save_value): Use new Lisp_Save_Value layout. Adjust comment.
+ (free_save_value): Likewise.
+ (mark_object): Likewise.
+ * editfns.c (save_excursion_save): Pack everything within
+ Lisp_Save_Value and so avoid xmalloc.
+ (save_excursion_restore): Adjust to match new layout. Use free_misc
+ because we do not allocate extra memory any more. Add eassert.
+ * print.c (print_object): New code to print Lisp_Save_Value. Do not
+ rely on valid_lisp_object_p if !GC_MARK_STACK. Adjust comments.
+ * dired.c, fileio.c, font.c, ftfont.c, gtkutil.c, keymap.c,
+ * lread.c, nsmenu.m, nsterm.h, xfns.c, xmenu.c, xselect.c:
+ Use XSAVE_POINTER and XSAVE_INTEGER where appropriate.
+
+2013-01-13 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsfont.m (LCD_SMOOTHING_MARGIN): New define.
+ (nsfont_draw): Remove disabling of LCD smoothing.
+ (ns_glyph_metrics): Add LCD_SMOOTHING_MARGIN to bearings to fix
+ Bug#11484 with LCD smoothing on.
+
+2013-01-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix SIGDANGER handlers, for AIX (Bug#13408).
+ * sysdep.c.c (handle_danger_signal, deliver_danger_signal) [SIGDANGER]:
+ Move handlers here from emacs.c; they were out of place.
+
2013-01-11 Jan Djärv <jan.h.d@swipnet.se>
* xterm.c (syms_of_xterm): Adjust documentation for