+2014-09-07 Eli Zaretskii <eliz@gnu.org>
+
+ * callproc.c (child_setup) [WINDOWSNT]: Don't call exec_failed if
+ 'alloca' gets passed arguments larger than MAX_ALLOCA.
+
+ * font.c (MAX): Define if not defined elsewhere.
+
+2014-09-07 Paul Eggert <eggert@cs.ucla.edu>
+
+ * keyboard.c (read_decoded_event_from_main_queue): Reinstitute alloca
+ here for destination buffer, to work around what appears to be a
+ bug in decode_coding_c_string when the source and destination are
+ both C strings.
+
+ Use SAFE_ALLOCA etc. to avoid unbounded stack allocation (Bug#18410).
+ This follows up on the recent thread in emacs-devel on alloca; see:
+ http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00042.html
+ This patch also cleans up alloca-related glitches noted while
+ examining the code looking for unbounded alloca.
+ * alloc.c (listn):
+ * callproc.c (init_callproc):
+ Rewrite to avoid need for alloca.
+ * buffer.c (mouse_face_overlay_overlaps)
+ (report_overlay_modification):
+ * buffer.h (GET_OVERLAYS_AT):
+ * coding.c (make_subsidiaries):
+ * doc.c (Fsnarf_documentation):
+ * editfns.c (Fuser_full_name):
+ * fileio.c (Ffile_name_directory, Fexpand_file_name)
+ (search_embedded_absfilename, Fsubstitute_in_file_name):
+ * fns.c (Fmake_hash_table):
+ * font.c (font_vconcat_entity_vectors, font_update_drivers):
+ * fontset.c (fontset_pattern_regexp, Ffontset_info):
+ * frame.c (Fmake_terminal_frame, x_set_frame_parameters)
+ (xrdb_get_resource, x_get_resource_string):
+ * ftfont.c (ftfont_get_charset, ftfont_check_otf, ftfont_drive_otf):
+ * ftxfont.c (ftxfont_draw):
+ * image.c (xbm_load, xpm_load, jpeg_load_body):
+ * keyboard.c (echo_add_key, menu_bar_items, tool_bar_items)
+
+ * keymap.c (Fdescribe_buffer_bindings, describe_map):
+ * lread.c (openp):
+ * menu.c (digest_single_submenu, find_and_call_menu_selection)
+ (find_and_return_menu_selection):
+ * print.c (PRINTFINISH):
+ * process.c (Fformat_network_address):
+ * scroll.c (do_scrolling, do_direct_scrolling, scrolling_1):
+ * search.c (search_buffer, Fmatch_data, Fregexp_quote):
+ * sound.c (wav_play, au_play):
+ * syntax.c (skip_chars):
+ * term.c (tty_menu_activate, tty_menu_show):
+ * textprop.c (get_char_property_and_overlay):
+ * window.c (Fset_window_configuration):
+ * xdisp.c (safe__call, next_overlay_change, vmessage)
+ (compute_overhangs_and_x, draw_glyphs, note_mouse_highlight):
+ * xfaces.c (face_at_buffer_position):
+ * xmenu.c (x_menu_show):
+ Use SAFE_ALLOCA etc. instead of plain alloca, since the
+ allocation size isn't bounded.
+ * callint.c (Fcall_interactively): Redo memory_full check
+ so that it can be done at compile-time on some platforms.
+ * coding.c (MAX_LOOKUP_MAX): New constant.
+ (get_translation_table): Use it.
+ * callproc.c (call_process): Use SAFE_NALLOCA instead of
+ SAFE_ALLOCA, to catch integer overflows on size calculation.
+ (exec_failed) [!DOS_NT]: New function.
+ (child_setup) [!DOS_NT]: Use it.
+ * editfns.c (Ftranspose_regions):
+ Hoist USE_SAFE_ALLOC + SAFE_FREE out of 'if'.
+ * editfns.c (check_translation):
+ Allocate larger buffers on the heap.
+ * eval.c (internal_lisp_condition_case):
+ Check for MAX_ALLOCA overflow.
+ * fns.c (sort_vector): Use SAFE_ALLOCA_LISP rather than Fmake_vector.
+ (Fbase64_encode_region, Fbase64_decode_region):
+ Avoid unnecessary calls to SAFE_FREE before 'error'.
+ * buffer.c (mouse_face_overlay_overlaps):
+ * editfns.c (Fget_pos_property, check_translation):
+ * eval.c (Ffuncall):
+ * font.c (font_unparse_xlfd, font_find_for_lface):
+ * ftfont.c (ftfont_drive_otf):
+ * keyboard.c (echo_add_key, read_decoded_event_from_main_queue)
+ (menu_bar_items, tool_bar_items):
+ * sound.c (Fplay_sound_internal):
+ * xdisp.c (load_overlay_strings, dump_glyph_row):
+ Use an ordinary auto buffer rather than alloca, since the
+ allocation size is fixed and small.
+ * ftfont.c: Include <c-strcase.h>.
+ (matching_prefix): New function.
+ (get_adstyle_property): Use it, to avoid need for alloca.
+ * keyboard.c (echo_add_key):
+ * keymap.c (describe_map): Use ptrdiff_t, not int.
+ * keyboard.c (echo_add_key): Prefer sizeof to strlen.
+ * keymap.c (Fdescribe_buffer_bindings): Use SBYTES, not SCHARS,
+ when counting bytes.
+ * lisp.h (xlispstrdupa): Remove, replacing with ...
+ (SAFE_ALLOCA_STRING): ... new macro with different API.
+ This fixes a portability problem, namely, alloca result
+ passed to another function. All uses changed.
+ (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Check for MAX_ALLOCA,
+ not MAX_ALLOCA - 1.
+ * regex.c (REGEX_USE_SAFE_ALLOCA, REGEX_SAFE_FREE)
+ (REGEX_ALLOCATE): New macros.
+ (REGEX_REALLOCATE, REGEX_ALLOCATE_STACK, REGEX_REALLOCATE_STACK)
+ (REGEX_FREE_STACK, FREE_VARIABLES, re_match_2_internal):
+ Use them.
+ * xdisp.c (message3): Use SAFE_ALLOCA_STRING rather than doing it
+ by hand.
+ (decode_mode_spec_coding): Store directly into buf rather than
+ into an alloca temporary and copying the temporary to the buf.
+
+2014-09-06 Eli Zaretskii <eliz@gnu.org>
+
+ * Makefile.in (EMACS_HEAPSIZE): Remove, no longer used. (Bug#18416)
+
+2014-09-04 Jan D <jhd@f20.localdomain>
+
+ * xterm.c (x_term_init): Don't call x_session_initialize if running
+ as a daemon (Bug#18375).
+
+ * xsmfns.c: Initialize ice_fd.
+
+2014-09-04 Paul Eggert <eggert@cs.ucla.edu>
+
+ Less chatter in 'make' output.
+ * Makefile.in (AM_V_GEN, am__v_GEN_, am__v_GEN_0, am__v_GEN_1, AM_V_at)
+ (am__v_at_, am__v_at_0, am__v_at_1): New macros, taken from Automake.
+ ($(etc)/DOC, buildobj.h, gl-stamp): Use them.
+
+2014-09-03 Martin Rudalics <rudalics@gmx.at>
+
+ * buffer.c (scroll-bar-height): Fix typo in doc-string.
+ * frame.c (Vdefault_frame_horizontal_scroll_bars): Remove
+ variable.
+ * nsfns.m (Fx_create_frame):
+ * w32fns.c (Fx_create_frame):
+ * xfns.c (Fx_create_frame): Default horizontal scroll bars to
+ nil.
+
+2014-09-03 Eli Zaretskii <eliz@gnu.org>
+
+ * dispnew.c (buffer_posn_from_coords): Fix an off-by-one error in
+ the reported row in the case of a window with a header line, by
+ improving on the fix committed in 2011-10-08T10:58:50Z!eliz@gnu.org
+ eliz@gnu.org-20111008105850-ht4tvsayohvr1kjc. (Bug#18384)
+
+2014-09-03 Paul Eggert <eggert@cs.ucla.edu>
+
+ * eval.c (internal_lisp_condition_case): Don't overrun the stack
+ when configured --with-wide-int on typical 32-bit platforms.
+
+2014-09-03 Eli Zaretskii <eliz@gnu.org>
+
+ * xdisp.c (display_and_set_cursor): Call erase_phys_cursor also
+ when HPOS is negative, for the benefit of R2L glyph rows whose
+ newline overflows into the fringe.
+
+2014-09-03 Ken Brown <kbrown@cornell.edu>
+
+ * conf_post.h (strnicmp) [CYGWIN && HAVE_NTGUI]: Define. (Bug#18366)
+
+2014-09-02 Paul Eggert <eggert@cs.ucla.edu>
+
+ Minor cleanup of recent strlen-avoiding patch.
+ * fileio.c (CHECK_LENGTH): Remove.
+ Rewrite callers so that they don't need it.
+ (Fexpand_file_name) [DOS_NT]: Fix a case where directory length
+ variable wasn't set.
+
+2014-09-02 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * fileio.c (CHECK_LENGTH): New macro.
+ (Fexpand_file_name): Use it and get rid of a few more calls
+ to strlen and strcat.
+ * callproc.c (egetenv_internal): Add arg and rename from egetenv ...
+ * lisp.h (egetenv): ... because of a new inline function used to
+ avoid calls to strlen for a compile-time constants.
+
+ * buffer.h (decode_buffer): New function.
+ * buffer.c (Fbuffer_name, Fbuffer_file_name, Fbuffer_base_buffer)
+ (Fbuffer_local_variables, Fbuffer_modified_p, Fbuffer_modified_tick)
+ (Fbuffer_chars_modified_tick, Fdelete_all_overlays):
+ * data.c (Flocal_variables_p):
+ * fileio.c (Fverify_visited_file_modtime):
+ * marker.c (live_buffer): Use it.
+
+2014-09-01 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Avoid extra calls to strlen in filesystem I/O routines.
+ * fileio.c (Fexpand_file_name): Avoid calls to strlen if
+ the length of 'newdir' is known or may be precalculated.
+ (file_accessible_directory_p): Prefer to pass Lisp_Object,
+ not 'char *', and so use precalculated length.
+ (Ffile_accessible_directory_p):
+ * callproc.c (encode_current_directory, init_callproc):
+ * charset.c (init_charset):
+ * lread.c (load_path_check, load_path_default): Adjust users.
+ * lisp.h (file_accessible_directory_p): Tweak prototype.
+
+2014-09-01 Eli Zaretskii <eliz@gnu.org>
+
+ * w32proc.c (w32_compare_strings): Support "C" and "POSIX"
+ locales.
+
+2014-09-01 Paul Eggert <eggert@cs.ucla.edu>
+
+ --enable-silent-rules now suppresses more chatter.
+ * Makefile.in (AM_DEFAULT_VERBOSITY, AM_V_CC, am__v_CC_)
+ (am__v_CC_0, am__v_CC_1, AM_V_CCLD, am__v_CCLD_, am__v_CCLD_0)
+ (am__v_CCLD_1): New macros, taken from Automake.
+ (.c.o, .m.o, temacs$(EXEEXT)): Use them.
+
+ Clean up extern decls a bit.
+ * bytecode.c: Include blockinput.h and keyboard.h rather
+ than rolling their APIs by hand.
+ * emacs.c: Include regex.h and rely on its and lisp.h's API
+ rather than rolling them by hand.
+ * lastfile.c: Include lisp.h, to check this file's API.
+ * lisp.h (lisp_eval_depth, my_edata, my_endbss, my_endbss_static):
+ New decls.
+ * regex.h (re_max_failures): New decl.
+ * unexcw.c, unexmacosx.c, unexw32.c:
+ Rely on lisp.h's API rather than rolling it by hand.
+ * vm-limit.c (__after_morecore_hook, __morecore, real_morecore):
+ Declare at top level, to pacify GCC -Wnested-externs.
+
+2014-08-31 Eli Zaretskii <eliz@gnu.org>
+
+ * xdisp.c (get_glyph_string_clip_rects): Don't let the width of a
+ clipping rectangle become negative (i.e. large positive, since
+ it's an unsigned data type). This can happen in R2L hscrolled
+ glyph rows, and caused us to draw the cursor glyph on the fringe.
+ For the details, see
+ http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00543.html.
+
+2014-08-31 Ken Brown <kbrown@cornell.edu>
+
+ * gmalloc.c: Don't include <stdlib.h>. Declare system malloc and
+ friends before defining hybrid_malloc and friends if HYBRID_MALLOC
+ is defined. (Bug#18368)
+
+2014-08-30 Paul Eggert <eggert@cs.ucla.edu>
+
+ Vector-sorting fixes (Bug#18361).
+ It's not safe to call qsort or qsort_r, since they have undefined
+ behavior if the user-specified predicate is not a total order.
+ Also, watch out for garbage-collection while sorting vectors.
+ * fns.c: Include <vla.h>.
+ (sort_vector_predicate) [!HAVE_QSORT_R]: Remove.
+ (sort_vector_compare): Remove, replacing with ....
+ (inorder, merge_vectors, sort_vector_inplace, sort_vector_copy):
+ ... these new functions.
+ (sort_vector): Rewrite to use the new functions.
+ GCPRO locals, since the predicate can invoke the GC.
+ Since it's in-place return void; caller changed.
+ (merge): Use 'inorder', for clarity.
+
+ * sysdep.c (str_collate): Clear errno just before wcscoll(_l).
+ One can't hoist this out of the 'if', because intervening calls to
+ newlocale, twolower, etc. can change errno.
+
+2014-08-30 Eli Zaretskii <eliz@gnu.org>
+
+ * sysdep.c (str_collate) [__STDC_ISO_10646__]: Improve the
+ wording of the error messages.
+ (str_collate) [WINDOWSNT]: Signal an error if w32_compare_strings
+ sets errno.
+
+ * w32proc.c (get_lcid_callback): Accept locale specifications
+ without the country part, as in "enu" vs "enu_USA".
+ (w32_compare_strings): Signal an error if a locale was specified,
+ but couldn't be translated into a valid LCID.
+
+2014-08-29 Michael Albinus <michael.albinus@gmx.de>
+
+ * sysdep.c (str_collate) [__STDC_ISO_10646__]: Move up setting errno.
+
+2014-08-29 Paul Eggert <eggert@cs.ucla.edu>
+
+ * sysdep.c (str_collate) [__STDC_ISO_10646__]: Do not look at
+ errno after towlower_l. errno's value is not specified after
+ towlower_l. Instead, assume that towlower_l returns its argument
+ on failure, which is portable in practice.
+
+2014-08-29 Eli Zaretskii <eliz@gnu.org>
+
+ * fns.c (Fstring_collate_lessp, Fstring_collate_equalp): Doc fix.
+
+ * w32proc.c (w32_compare_strings): Accept additional argument
+ IGNORE_CASE. Set up the flags for CompareStringW to ignore case
+ if requested. If w32-collate-ignore-punctuation is non-nil, add
+ NORM_IGNORESYMBOLS to the flags.
+ (LINGUISTIC_IGNORECASE): Define if not already defined.
+ (syms_of_ntproc) <Vw32_collate_ignore_punctuation>: New variable.
+
+ * sysdep.c (str_collate) [WINDOWSNT]: Adapt to the interface
+ change.
+
+2014-08-29 Michael Albinus <michael.albinus@gmx.de>
+
+ * sysdep.c (LC_CTYPE, LC_CTYPE_MASK, towlower_l):
+ Define substitutes for platforms that lack them.
+ (str_collate): Add arguments locale and ignore_case.
+
+ * fns.c (Fstring_collate_lessp, Fstring_collate_equalp):
+ Add optional arguments LOCALE and IGNORE-CASE.
+
+ * lisp.h (str_collate): Adapt argument list.
+
+2014-08-29 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Add vectors support to Fsort.
+ * fns.c (sort_vector, sort_vector_compare): New functions.
+ (sort_list): Likewise, refactored out of ...
+ (Fsort): ... adjusted user. Mention vectors in docstring.
+ (sort_vector_predicate) [!HAVE_QSORT_R]: New variable.
+ * alloc.c (make_save_int_obj): New function.
+ * lisp.h (enum Lisp_Save_Type): New member SAVE_TYPE_INT_OBJ.
+ (make_save_int_obj): Add prototype.
+
+ Fix last change to support Darwin/OSX and FreeBSD (Bug#18354).
+ * sysdep.c (sort_vector_compare) [DARWIN_OS || __FreeBSD__]:
+ Conditionally define to match system's qsort_r signature.
+ (sort_vector) [DARWIN_OS || __FreeBSD__]: Likewise in call to qsort_r.
+
+2014-08-28 Ken Brown <kbrown@cornell.edu>
+
+ Add support for HYBRID_MALLOC, allowing the use of gmalloc before
+ dumping and the system malloc after dumping. (Bug#18222)
+
+ * conf_post.h (malloc, realloc, calloc, free) [HYBRID_MALLOC]:
+ Define as macros, expanding to hybrid_malloc, etc.
+ (HYBRID_GET_CURRENT_DIR_NAME): New macro.
+ (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: Define as
+ macro.
+ * gmalloc.c: Set up the infrastructure for HYBRID_MALLOC, with a
+ full implementation on Cygwin. Remove Cygwin-specific code that
+ is no longer needed.
+ (malloc, realloc, calloc, free, aligned_alloc) [HYBRID_MALLOC]:
+ Redefine as macros expanding to gmalloc, grealloc, etc.
+ (DUMPED, ALLOCATED_BEFORE_DUMPING) [CYGWIN]: New macros.
+ (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]: Undefine.
+ (USE_PTHREAD, posix_memalign) [HYBRID_MALLOC]: Don't define.
+ (hybrid_malloc, hybrid_calloc, hybrid_free, hybrid_realloc)
+ [HYBRID_MALLOC]:
+ (hybrid_get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]:
+ (hybrid_aligned_alloc) [HYBRID_MALLOC && (HAVE_ALIGNED_ALLOC ||
+ HAVE_POSIX_MEMALIGN)]: New functions.
+ * alloc.c (aligned_alloc) [HYBRID_MALLOC && (ALIGNED_ALLOC ||
+ HAVE_POSIX_MEMALIGN)]: Define as macro expanding to
+ hybrid_aligned_alloc; declare.
+ (USE_ALIGNED_ALLOC) [HYBRID_MALLOC && (ALIGNED_ALLOC ||
+ HAVE_POSIX_MEMALIGN)]: Define.
+ (refill_memory_reserve) [HYBRID_MALLOC]: Do nothing.
+ * sysdep.c (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]:
+ Define as macro, expanding to gget_current_dir_name, and define
+ the latter.
+ * emacs.c (main) [HYBRID_MALLOC]: Don't call memory_warnings() or
+ malloc_enable_thread(). Don't initialize malloc.
+ * lisp.h (NONPOINTER_BITS) [CYGWIN]: Define (because GNU_MALLOC is
+ no longer defined on Cygwin).
+ (refill_memory_reserve) [HYBRID_MALLOC]: Don't declare.
+ * sheap.c (bss_sbrk_buffer_end): New variable.
+ * unexcw.c (__malloc_initialized): Remove variable.
+ * ralloc.c: Throughout, treat HYBRID_MALLOC the same as
+ SYSTEM_MALLOC.
+ * xdisp.c (decode_mode_spec) [HYBRID_MALLOC]: Don't check
+ Vmemory_full.
+
+2014-08-28 Martin Rudalics <rudalics@gmx.at>
+
+ * w32term.c (w32_horizontal_scroll_bar_handle_click): In
+ `event->y' return entire range (the size of the scroll bar minus
+ that of the thumb).
+ * xterm.c (xm_scroll_callback, xaw_jump_callback): In `whole'
+ return entire range (the scaled size of the scroll bar minus
+ that of the slider). In `portion' return the scaled position of
+ the slider.
+ (xaw_jump_callback): Restore part of code for vertical scroll
+ bar broken in change from 2014-07-27.
+ (xaw_scroll_callback): Provide incremental scrolling with
+ horizontal scroll bars.
+
+2014-08-28 Eli Zaretskii <eliz@gnu.org>
+
+ * conf_post.h (_GL_EXECINFO_INLINE) [MSDOS]: Don't define.
+
+ * indent.c (Fvertical_motion): Fix vertical motion up through a
+ display property after a newline. (Bug#18276)
+
+ * xdisp.c (display_line): Don't assume that the call to
+ reseat_at_next_visible_line_start ends up at a character
+ immediately following the newline on the previous line. Avoids
+ setting the ends_at_zv_p flag on screen lines that are not at or
+ beyond ZV, which causes infloop in redisplay. For the details, see
+ http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00368.html.
+
+ * dispnew.c (buffer_posn_from_coords): Fix mirroring of X
+ coordinate for hscrolled R2L screen lines. (Bug#18277)
+
+2014-08-28 Paul Eggert <eggert@cs.ucla.edu>
+
+ * sysdep.c (LC_COLLATE, LC_COLLATE_MASK): Give individual defaults
+ (Bug#18051).
+
+2014-08-27 Eli Zaretskii <eliz@gnu.org>
+
+ * syntax.c (scan_lists): Don't examine positions before BEGV.
+ (Bug#18339)
+
+2014-08-27 Paul Eggert <eggert@cs.ucla.edu>
+
+ Improve robustness of new string-collation code (Bug#18051).
+ * sysdep.c (LC_COLLATE, LC_COLLATE_MASK, freelocale, locale_t)
+ (newlocale, wcscoll_l): Define substitutes for platforms that
+ lack them, so as to simplify the mainline code.
+ (str_collate): Simplify the code by assuming the above definitions.
+ Use wcscoll_l, not uselocale, as uselocale is too fragile. For
+ example, the old version left the Emacs in the wrong locale if
+ wcscoll reported an error. Use 'int', not ptrdiff_t, for the int
+ result. Report an error if newlocale fails.
+
+2014-08-27 Michael Albinus <michael.albinus@gmx.de>
+
+ * lisp.h (str_collate):
+ * sysdep.c (str_collate): Return int.
+ (str_collate) [__STDC_ISO_10646__]: Propagate error of wcscoll.
+
2014-08-27 Dmitry Antipov <dmantipov@yandex.ru>
Fix some glitches in previous change.
(handle_sigsegv): Check whether we really crash somewhere near
to stack boundary, and handle fatal signal as usual if not.
(init_sigsegv): Adjust accordingly.
+ * keyboard.c (Vtop_level_message): Rename to
+ Vinternal__top_level_message, as suggested by Stefan Monnier in
+ http://lists.gnu.org/archive/html/emacs-devel/2014-08/msg00493.html
+ All related users changed.
2014-08-26 Dmitry Antipov <dmantipov@yandex.ru>
* dispextern.h (struct face) [HAVE_XFT]: Ifdef 'extra' member.
* font.c (font_done_for_face):
- * xface.c (realize_non_ascii_face): Adjust user.
+ * xfaces.c (realize_non_ascii_face): Adjust user.
* font.h (struct font_driver): Convert 'prepare_face' to return
void because its return value is never used anyway.
* xfont.c (xfont_prepare_face): Return void.
Use mmap(2) emulation for allocating buffer text on MS-Windows.
* Makefile.in (C_HEAP_SWITCH): Get the predefined heap size from
- configure.
+ configure, not from HEAPSIZE.
(ADDSECTION, MINGW_TEMACS_POST_LINK): Remove, no longer used.
* lisp.h (NONPOINTER_BITS): Modify the condition to define to zero