1. 23 Sep, 2014 3 commits
    • Paul Eggert's avatar
      * lisp.h (lispstpcpy): Rename from lispstrcpy, and act like stpcpy. · 97914756
      Paul Eggert authored
      All callers changed.
      * xterm.c (x_term_init): Use new functionality to avoid two needs
      to compute a string length.
      97914756
    • Dmitry Antipov's avatar
      Use known length of a Lisp string to copy it faster. · 59e10fbd
      Dmitry Antipov authored
      * lisp.h (lispstrcpy): New function.  Add comment.
      * callproc.c (child_setup):
      * dbusbind.c (xd_append_arg):
      * doc.c (get_doc_string):
      * font.c (Ffont_xlfd_name):
      * frame.c (xrdb_get_resource):
      * process.c (Fmake_network_process, network_interface_info):
      * w32fns.c (Fx_open_connection):
      * w32proc.c (sys_spawnve):
      * xfns.c (select_visual):
      * xfont.c (xfont_list):
      * xsmfns.c (x_session_initialize):
      * xterm.c (x_term_init): Use it.
      59e10fbd
    • Paul Eggert's avatar
      Fix SAFE_ALLOCA to not exhaust the stack when in a loop. · cb8e2bfb
      Paul Eggert authored
      Problem reported by Dmietry Antipov in thread leading to:
      http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00713.html
      This patch fixes only SAFE_ALLOCA, SAFE_NALLOCA, and SAFE_ALLOCA_LISP;
      the experimental local_* macros enabled by USE_LOCAL_ALLOCATORS
      remain unfixed.
      * callproc.c (call_process): Save and restore sa_avail.
      * lisp.h (USE_SAFE_ALLOCA): Define sa_avail.
      (AVAIL_ALLOCA): New macro.
      (SAFE_ALLOCA, SAFE_NALLOCA, SAFE_ALLOCA_LISP):
      Use it, and check against sa_avail rather than MAX_ALLOCA.
      cb8e2bfb
  2. 22 Sep, 2014 1 commit
  3. 21 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Minor improvements to new stack-allocated Lisp objects. · f135e94e
      Paul Eggert authored
      * frame.h (FRAME_PARAMETER):
      Prefer scoped_list1 to local_list1 where either would do.
      * lisp.h (scoped_list4): New macro.
      (local_cons, local_list1, local_list2, local_list3, local_list4)
      (make_local_vector, make_local_string, build_local_string):
      Prefer functions to macros where either would do.
      * xdisp.c (build_desired_tool_bar_string):
      Prefer scoped_list4 to local_list4 where either would do.
      f135e94e
  4. 18 Sep, 2014 3 commits
    • Dmitry Antipov's avatar
      More and more stack-allocated Lisp objects if USE_LOCAL_ALLOCATORS. · 3cab7dd4
      Dmitry Antipov authored
      * lisp.h (local_list4) [USE_LOCAL_ALLOCATORS]: New macro.
      [!USE_LOCAL_ALLOCATORS]: Fall back to regular list4.
      * frame.h (FRAME_PARAMETER): New macro.
      * dispnew.c (init_display):
      * fontset.c (Fset_fontset_font):
      * frame.c (x_default_parameter):
      * xfaces.c (set_font_frame_param, Finternal_merge_in_global_face):
      * xfns.c (x_default_scroll_bar_color_parameter)
      (x_default_font_parameter, x_create_tip_frame): Use it.
      * editfns.c (Fpropertize): Use local_cons.
      * process.c (status_message): Use build_local_string.
      * xfont.c (xfont_open): Use make_local_string.
      * xdisp.c (build_desired_tool_bar_string): Use local_list4.
      3cab7dd4
    • Paul Eggert's avatar
      Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. · e8be4f44
      Paul Eggert authored
      Revert previous lisp.h change, and install the following instead.
      * lisp.h (USE_LOCAL_ALLOCATORS): Define only if __GNUC__ &&
      !__clang__.  This works with GCC and with clang and is safer for
      compilers we don't know about.
      e8be4f44
    • Paul Eggert's avatar
      Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64. · bb95ed98
      Paul Eggert authored
      * lisp.h (ALLOCA_FIXUP): New constant.
      (LOCAL_ALLOCA): New macro.
      (local_cons, make_local_vector, make_local_string): Use them.
      (local_cons): Rename parameter to make capture less likely.
      bb95ed98
  5. 17 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Fix minor problems found by static checking. · 9356a872
      Paul Eggert authored
      * alloc.c, lisp.h (SAVE_TYPE_INT_OBJ, make_save_int_obj):
      Remove; now unused.
      * buffer.h (decode_buffer): Doc and indentation fixes.
      * fns.c (Qstring_collate_lessp, Qstring_collate_equalp): Now static.
      9356a872
  6. 16 Sep, 2014 1 commit
    • Dmitry Antipov's avatar
      Always use matched specpdl entry to record call arguments (Bug#18473). · ccb767d6
      Dmitry Antipov authored
      * lisp.h (record_in_backtrace): Adjust prototype.
      * eval.c (record_in_backtrace): Return current specpdl level.
      (set_backtrace_args, set_backtrace_nargs): Merge.  Adjust all users.
      (eval_sub, Ffuncall): Record call arguments in matched specpdl
      entry and use that entry in call to backtrace_debug_on_exit.
      (apply_lambda): Likewise.  Get current specpdl level as 3rd arg.
      (do_debug_on_call): Get current specpdl level as 2nd arg.
      ccb767d6
  7. 15 Sep, 2014 1 commit
    • Dmitry Antipov's avatar
      If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack. · edb0288b
      Dmitry Antipov authored
      * lisp.h (local_cons, local_list1, local_list2, local_list3)
      [USE_LOCAL_ALLOCATORS]: New macros.
      [!USE_LOCAL_ALLOCATORS]: Fall back to regular functions.
      (build_local_string): Avoid argument name expansion clash with
      make_local_string.
      * alloc.c (toplevel)
      [USE_LOCAL_ALLOCATORS && GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS]:
      Preprocessor guard to avoid impossible configuration.
      * charset.c (Ffind_charset_region, Ffind_charset_string):
      Use make_local_vector.
      * lread.c (read1, substitute_object_recurse): Use scoped_cons.
      * textprop.c (Fput_text_property, Fadd_face_text_property):
      Use scoped_list2.
      (copy_text_properties): Use local_cons and local_list3.
      * chartab.c (uniprop_table):
      * data.c (wrong_choice, wrong_range):
      * doc.c (get_doc_string):
      * editfns.c (format2):
      * fileio.c (Fexpand_file_name, auto_save_error):
      * fns.c (Fyes_or_no_p):
      * font.c (font_parse_xlfd, font_parse_family_registry, font_add_log):
      * fontset.c (Fset_fontset_font):
      * keyboard.c (echo_add_key, echo_dash, parse_menu_item)
      (read_char_minibuf_menu_prompt):
      * keymap.c (silly_event_symbol_error, describe_vector):
      * menu.c (single_menu_item):
      * minibuf.c (Fread_buffer):
      * process.c (status_message, Fformat_network_address)
      (server_accept_connection): Use make_local_string and
      build_local_string.  Prefer compound literals where appropriate.
      edb0288b
  8. 11 Sep, 2014 2 commits
  9. 10 Sep, 2014 3 commits
    • Paul Eggert's avatar
      Simplify lisp.h by removing the __COUNTER__ business. · d1bed1f7
      Paul Eggert authored
      Problem reported by Dmitry Antipov in:
      http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00220.html
      * lisp.h (make_local_vector, make_local_string)
      (build_local_string): Simplify by not bothering with __COUNTER__.
      The __COUNTER__ business wasn't working properly, and was needed
      only for hypothetical future expansion anyway.
      d1bed1f7
    • Paul Eggert's avatar
      * lisp.h (DEFINE_GDB_SYMBOL_ENUM): Remove. · c9c0610d
      Paul Eggert authored
      These can generate a constant with the correct value but the wrong
      width, which doesn't work as a printf argument.  All uses removed.
      Problem reported by Dmitry Antipov in:
      http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00213.html
      (ENUMABLE): Remove; no longer needed.
      (ARRAY_MARK_FLAG_val, PSEUDOVECTOR_FLAG_val, VALMASK_val):
      Remove; no longer needed because of the above change.
      Each definiens moved to the only use.
      c9c0610d
    • Paul Eggert's avatar
      Improve the experimental local and scoped allocation. · 11e28ab0
      Paul Eggert authored
      * configure.ac (HAVE_STRUCT_ATTRIBUTE_ALIGNED)
      (HAVE_STATEMENT_EXPRESSIONS): New configure-time checks.
      * src/alloc.c (local_string_init, local_vector_init):
      New functions, defined if USE_LOCAL_ALLOCATORS.
      Mostly, these are moved here from lisp.h, as it's not
      clear it's worth making them inline.
      * src/lisp.h (USE_STACK_LISP_OBJECTS): Default to false.
      (GCALIGNED): Depend on HAVE_STRUCT_ATTRIBUTE_ALIGNED and
      USE_STACK_LISP_OBJECTS, not on a laundry list.
      (local_string_init, local_vector_init): New decls.
      (union Aligned_Cons): New type.
      (scoped_cons): Use it.  Give up on the char trick, as it's a too
      much of a maintenance hassle; if someone wants this speedup
      they'll just need to convince their compiler to align properly.
      Conversely, use the speedup if struct Lisp_Cons happens to
      be aligned even without a directive.  Better yet, help it along
      by using union Aligned_Cons rather than struct Lisp_Cons.
      (pointer_valid_for_lisp_object): Remove.  This check is not
      necessary, since make_lisp_ptr is already doing it.  All uses removed.
      (local_vector_init, local_string_init): Move to alloc.c.
      (build_local_vector): Remove this awkward macro, replacing with ...
      (make_local_vector): New macro, which acts more like a function.
      Use statement expressions and use __COUNTER__ to avoid macro
      capture.  Fall back on functions if these features are not supported.
      (build_local_string, make_local_string): Likewise.
      11e28ab0
  10. 09 Sep, 2014 2 commits
    • Dmitry Antipov's avatar
      Cleanup last change and make all new stuff conditional. · e2588fa5
      Dmitry Antipov authored
      * lisp.h (build_local_string): Rename to ...
      (make_local_string): ... this macro.
      (build_local_string, scoped_list1, scoped_list3): New macros.
      (toplevel) [USE_STACK_LISP_OBJECTS]: Define all new macros
      and functions as such, use regular fallbacks otherwise.
      * alloc.c (verify_alloca) [USE_STACK_LISP_OBJECTS]: Define
      conditionally.
      e2588fa5
    • Dmitry Antipov's avatar
      Add macros to allocate temporary Lisp objects with alloca. · c7dfea94
      Dmitry Antipov authored
      Respect MAX_ALLOCA and fall back to regular GC for large objects.
      * character.h (parse_str_as_multibyte): Move prototype to ...
      * lisp.h (parse_str_as_multibyte): ... here.
      (struct Lisp_Cons): Add GCALIGNED attribute if supported.
      (scoped_cons, scoped_list2, build_local_vector, build_local_string):
      New macros.
      (scoped_cons_init, pointer_valid_for_lisp_object, local_vector_init)
      (local_string_init): New functions.
      * alloc.c (verify_alloca) [ENABLE_CHECKING]: New function.
      (init_alloc_once): Call it.
      c7dfea94
  11. 07 Sep, 2014 1 commit
    • Paul Eggert's avatar
      Use SAFE_ALLOCA etc. to avoid unbounded stack allocation. · b3bf18b3
      Paul Eggert authored
      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.
      
      Fixes: debbugs:18410
      b3bf18b3
  12. 02 Sep, 2014 2 commits
  13. 01 Sep, 2014 2 commits
    • Dmitry Antipov's avatar
      Avoid extra calls to strlen in filesystem I/O routines. · 50e9e580
      Dmitry Antipov authored
      * 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.
      50e9e580
    • Paul Eggert's avatar
      Clean up extern decls a bit. · 1564080f
      Paul Eggert authored
      * configure.ac (WERROR_CFLAGS): Don't disable -Wnested-externs.
      While we're at it, don't disable -Wlogical-op either.
      * src/bytecode.c: Include blockinput.h and keyboard.h rather
      than rolling their APIs by hand.
      * src/emacs.c: Include regex.h and rely on its and lisp.h's API
      rather than rolling them by hand.
      * src/lastfile.c: Include lisp.h, to check this file's API.
      * src/lisp.h (lisp_eval_depth, my_edata, my_endbss, my_endbss_static):
      New decls.
      * src/regex.h (re_max_failures): New decl.
      * src/unexcw.c, src/unexmacosx.c, src/unexw32.c:
      Rely on lisp.h's API rather than rolling it by hand.
      * src/vm-limit.c (__after_morecore_hook, __morecore, real_morecore):
      Declare at top level, to pacify GCC -Wnested-externs.
      1564080f
  14. 29 Aug, 2014 2 commits
    • Michael Albinus's avatar
      Add optional arguments LOCALE and IGNORE-CASE to collation functions. · b579ae53
      Michael Albinus authored
      * fns.c (Fstring_collate_lessp, Fstring_collate_equalp):
      Add optional arguments LOCALE and IGNORE-CASE.
      
      * lisp.h (str_collate): Adapt argument list.
      
      * sysdep.c (LC_CTYPE, LC_CTYPE_MASK, towlower_l):
      Define substitutes for platforms that lack them.
      (str_collate): Add arguments locale and ignore_case.
      b579ae53
    • Dmitry Antipov's avatar
      Add vectors support to Fsort. · 1764ec44
      Dmitry Antipov authored
      * configure.ac (AC_CHECK_FUNCS): Check for qsort_r.
      * src/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.
      * src/alloc.c (make_save_int_obj): New function.
      * src/lisp.h (enum Lisp_Save_Type): New member SAVE_TYPE_INT_OBJ.
      (make_save_int_obj): Add prototype.
      * test/automated/fns-tests.el (fns-tests-sort): New test.
      1764ec44
  15. 28 Aug, 2014 1 commit
    • Ken Brown's avatar
      Add support for HYBRID_MALLOC, allowing the use of gmalloc before · ea652500
      Ken Brown authored
      dumping and the system malloc after dumping.  (Bug#18222)
      
      * configure.ac (HYBRID_MALLOC): New macro; define to use gmalloc
      before dumping and the system malloc after dumping.  Define on Cygwin.
      * src/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.
      * src/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.
      * src/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.
      * src/sysdep.c (get_current_dir_name) [HYBRID_GET_CURRENT_DIR_NAME]:
      Define as macro, expanding to gget_current_dir_name, and define
      the latter.
      * src/emacs.c (main) [HYBRID_MALLOC]: Don't call memory_warnings() or
      malloc_enable_thread().  Don't initialize malloc.
      * src/lisp.h (NONPOINTER_BITS) [CYGWIN]: Define (because GNU_MALLOC is
      no longer defined on Cygwin).
      (refill_memory_reserve) [HYBRID_MALLOC]: Don't declare.
      * src/sheap.c (bss_sbrk_buffer_end): New variable.
      * src/unexcw.c (__malloc_initialized): Remove variable.
      * src/ralloc.c: Throughout, treat HYBRID_MALLOC the same as
      SYSTEM_MALLOC.
      * src/xdisp.c (decode_mode_spec) [HYBRID_MALLOC]: Don't check
      	Vmemory_full.
      ea652500
  16. 27 Aug, 2014 1 commit
  17. 26 Aug, 2014 1 commit
    • Dmitry Antipov's avatar
      Handle C stack overflow caused by too nested Lisp evaluation. · ebd31792
      Dmitry Antipov authored
      * configure.ac: Check for sigaltstack and related sigaction
      support.  Unconditionally check for sigsetjmp and siglongjmp.
      (HAVE_STACK_OVERFLOW_HANDLING): Define if we can support it.
      * src/lisp.h (toplevel) [HAVE_STACK_OVERFLOW_HANDLING]: Declare
      siglongjmp point to transfer control from SIGSEGV handler.
      * src/keyboard.c (return_to_command_loop, recover_top_level_message)
      [HAVE_STACK_OVERFLOW_HANDLING]: New variables.
      (regular_top_level_message): New variable.
      (command_loop) [HAVE_STACK_OVERFLOW_HANDLING]: Handle non-local
      exit from SIGSEGV handler and adjust message displayed by Vtop_level
      if appropriate.
      (syms_of_keyboard): DEFVAR Vtop_level_message and initialize
      new variables described above.
      * src/sysdep.c [HAVE_SYS_RESOURCE_H]: Include sys/resource.h as such.
      (stack_grows_down, sigsegv_stack, handle_sigsegv)
      [HAVE_STACK_OVERFLOW_HANDLING]: New variables and function.
      (init_sigsegv): New function.
      (init_signals): Use it.
      * lisp/startup.el (normal-top-level): Use top-level-message.
      ebd31792
  18. 25 Aug, 2014 1 commit
    • Paul Eggert's avatar
      Minor cleanups of str_collate fix. · 90c5c877
      Paul Eggert authored
      * fns.c (str_collate): Move decl from here ...
      * lisp.h (str_collate): ... to here.
      * sysdep.c (str_collate): Prune away some of the forest of ifdefs.
      Remove unnecessary casts.  Use SAFE_NALLOCA to avoid
      potential problems with integer overflow.  Don't assume
      setlocale succeeds.  Remove unnecessary test before restoring
      locale via setlocale, and free the copied setlocale string
      when done with it.
      
      Fixes: debbugs:18051
      90c5c877
  19. 28 Jul, 2014 1 commit
    • Dmitry Antipov's avatar
      On GNU/Linux, use timerfd for asynchronous timers. · 768b24eb
      Dmitry Antipov authored
      * configure.ac (toplevel): Check whether GNU/Linux-specific
      timerfd functions and macros are available.
      * m4/clock_time.m4 (gl_CLOCK_TIME): Check for clock_getres as well.
      * src/atimer.c (toplevel) [HAVE_TIMERFD]: Include sys/timerfd.h.
      (toplevel): Rename alarm_timer_ok to special_timer_available.
      [HAVE_TIMERFD]: Declare timerfd.
      [HAVE_CLOCK_GETRES]: Declare resolution.
      (start_atimer) [HAVE_CLOCK_GETRES]: Round up timestamp to
      system timer resolution.
      (set_alarm) [HAVE_TIMERFD]: Use timerfd_settime.
      (timerfd_callback) [HAVE_TIMERFD]: New function.
      (atimer_result, debug_timer_callback, Fdebug_timer_check)
      [ENABLE_CHECKING]: New function for the sake of automated tests.
      (init_atimer) [HAVE_TIMERFD]: Setup timerfd.
      [HAVE_CLOCK_GETRES]: Likewise for system timer resolution.
      [ENABLE_CHECKING]: Defsubr test function.
      * src/atimer.h (timerfd_callback) [HAVE_TIMERFD]: Add prototype.
      * src/lisp.h (add_timer_wait_descriptor) [HAVE_TIMERFD]: Likewise.
      * src/process.c (add_timer_wait_descriptor) [HAVE_TIMERFD]: New function.
      * test/automated/timer-tests.el (timer-tests-debug-timer-check): New test.
      768b24eb
  20. 26 Jul, 2014 2 commits
    • Paul Eggert's avatar
      Revert previous change. · 9e9f8582
      Paul Eggert authored
      There is certainly nothing wrong with writing code like 'lo <= i
      && i <= hi', even if LO happens to a constant.  There isn't even
      anything wrong in general with writing 'a <= b' if A happens to
      be a constant.  At any rate stylistic changes shouldn't
      be done like this without discussion.
      9e9f8582
    • Andreas Schwab's avatar
      Reorder conditions that are written backwards · 3acf58ee
      Andreas Schwab authored
      * alloc.c (xnmalloc, xnrealloc, xpalloc, make_save_value)
      (Fgarbage_collect): Reorder conditions that are written backwards.
      * data.c (cons_to_unsigned): Likewise.
      * dispnew.c (update_frame_1, sit_for): Likewise.
      * fileio.c (file_offset): Likewise.
      * filelock.c (read_lock_data, lock_file): Likewise.
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      Likewise.
      * font.c (font_intern_prop, font_style_symbolic): Likewise.
      * lisp.h (FIXNUM_OVERFLOW_P): Likewise.
      * lread.c (read1): Likewise.
      * minibuf.c (read_minibuf_noninteractive): Likewise.
      * nsterm.m (x_set_frame_alpha): Likewise.
      * process.c (wait_reading_process_output): Likewise.
      * region-cache.c (delete_cache_boundaries): Likewise.
      * xterm.c (x_set_frame_alpha): Likewise.
      3acf58ee
  21. 18 Jul, 2014 1 commit
    • Dmitry Antipov's avatar
      * frame.c (frame_unspecified_color): New function · 0e604077
      Dmitry Antipov authored
      refactored out from ...
      (Fframe_parameters, Fframe_parameter): ... adjusted users.
      (x_fullscreen_adjust, set_frame_param): Move Windows-specific
      function to ...
      * w32term.c (x_fullscreen_adjust, set_frame_param): ... static here.
      * frame.h (x_fullscreen_adjust) [HAVE_NTGUI]:
      * lisp.h (set_frame_param): Remove prototype.
      * xterm.c (x_display_pixel_width, x_display_pixel_height): Now ...
      * xterm.h (x_display_pixel_width, x_display_pixel_height): ...
      inlined from here.
      0e604077
  22. 17 Jul, 2014 1 commit
    • Dmitry Antipov's avatar
      * data.c (wrong_choice): Not static any more. · 5d59504a
      Dmitry Antipov authored
      * lisp.h (wrong_choice): Add prototype.
      * frame.h (struct frame) [USE_X_TOOLKIT || HAVE_NTGUI]:
      Declare namebuf as such.  Tweak comment.
      [USE_GTK]: Likewise for tool_bar_position.
      (fset_tool_bar_position) [USE_GTK]: Ditto.
      (FRAME_TOOL_BAR_POSITION): New macro.
      * frame.c (x_report_frame_params):
      * gtkutil.c (update_frame_tool_bar):
      * xfns.c (Fx_create_frame): Use it.
      (x_set_tool_bar_position): Add meaningful diagnostic messages.
      5d59504a
  23. 14 Jul, 2014 1 commit
  24. 08 Jul, 2014 1 commit
    • Dmitry Antipov's avatar
      * chartab.c (char_table_translate): Move to... · f298de52
      Dmitry Antipov authored
      * character.h (char_table_translate): ... inline function here.
      Avoid Faref and assume that args are always valid.  This helps to
      speedup search, which is especially important for a huge buffers.
      * lisp.h (char_table_translate): Remove prototype.
      f298de52
  25. 02 Jul, 2014 2 commits
    • Dmitry Antipov's avatar
      * lisp.h (toplevel): Add compile-time assert to verify suitable member layout · e993f8d5
      Dmitry Antipov authored
      in Lisp_Sub_Char_Table.
      e993f8d5
    • Dmitry Antipov's avatar
      Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects. · 477daa5b
      Dmitry Antipov authored
      * lisp.h (struct Lisp_Sub_Char_Table): Use C integers for depth and
      min_char slots.  Adjust comment.
      (enum char_table_specials): Rename from CHAR_TABLE_STANDARD_SLOTS.
      Add SUB_CHAR_TABLE_OFFSET member.
      (make_uninit_sub_char_table): New function.
      * alloc.c (mark_char_table): Add extra argument to denote char table
      subtype.  Adjust to match new layout of sub char-table.
      (mark_object): Always mark sub char-tables with mark_char_table.
      * chartab.c (make_sub_char_table, copy_sub_char_table)
      (sub_char_table_ref, sub_char_table_ref_and_range, sub_char_table_set)
      (sub_char_table_set_range, optimize_sub_char_table, map_sub_char_table)
      (map_sub_char_table_for_charset, uniprop_table_uncompress):
      All related users changed.
      * lread.c (read1): Adjust to match new layout of sub char-table.
      477daa5b
  26. 25 Jun, 2014 1 commit
    • Dmitry Antipov's avatar
      Consistently use validate_subarray to verify substring. · 51e12e8e
      Dmitry Antipov authored
      * fns.c (validate_substring): Not static any more.  Adjust to
      use ptrdiff_t, not EMACS_INT, becase string and vector limits
      can't exceed ptrdiff_t even if EMACS_INT is wider.
      * lisp.h (validate_subarray): Add prototype.
      * coding.c (Fundecodable_char_position):
      * composite.c (Fcomposition_get_gstring, Fcompose_string_internal):
      Use validate_subarray.  Adjust comment to mention substring.
      51e12e8e
  27. 24 Jun, 2014 1 commit
    • Paul Eggert's avatar
      Be more consistent about the 'Qfoo' naming convention. · 40f5d4b7
      Paul Eggert authored
      * image.c (Fimagemagick_types):
      * lisp.h (lisp_h_CHECK_TYPE, CHECK_TYPE, CHECK_ARRAY):
      * process.c (Fmake_network_process):
      Rename C local identifier 'Qfoo to avoid giving the false
      impression that it stands for the symbol 'foo'.
      40f5d4b7