1. 10 Jul, 2013 1 commit
    • Paul Eggert's avatar
      Syntax cleanup, mostly replacing macros with functions. · 45b683a1
      Paul Eggert authored
      This removes the need for the syntax_temp hack.
      * search.c: Include syntax.h after buffer.h, since syntax.h uses BVAR.
      * syntax.c (SYNTAX_INLINE): New macro.
      (SYNTAX_FLAGS_COMSTART_FIRST, SYNTAX_FLAGS_COMSTART_SECOND)
      (SYNTAX_FLAGS_COMEND_FIRST, SYNTAX_FLAGS_COMEND_SECOND)
      (SYNTAX_FLAGS_PREFIX, SYNTAX_FLAGS_COMMENT_STYLEB)
      (SYNTAX_FLAGS_COMMENT_STYLEC, SYNTAX_FLAGS_COMMENT_STYLEC2)
      (SYNTAX_FLAGS_COMMENT_NESTED, SYNTAX_FLAGS_COMMENT_STYLE)
      (SYNTAX_COMEND_FIRST): Now functions, not macros.
      (ST_COMMENT_STYLE, ST_STRING_STYLE, INTERVALS_AT_ONCE):
      Now constants, not macros.
      (syntax_temp) [!__GNUC__]: Remove.
      (SYNTAX_PREFIX): Remove; all uses replaced by syntax_prefix_flag_p.
      (syntax_prefix_flag_p): Move implementation of SYNTAX_PREFIX here.
      (SET_RAW_SYNTAX_ENTRY, SET_RAW_SYNTAX_ENTRY_RANGE, SYNTAX_MATCH)
      (SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT):
      Move here from syntax.h; now functions, not macros.  Except for the
      last function, these are static since only syntax.c uses them.
      (syntax_multibyte): Rename from SYNTAX_WITH_MULTIBYTE_CHECK.
      All uses changed.  Now a function, not a macro; use this fact
      to simplify the code.
      (scan_lists, scan_sexps_forward): Remove workarounds for ancient
      compiler bugs; no longer relevant.
      * syntax.h: Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
      (SYNTAX_INLINE): New macro.
      (struct gl_state_s, gl_state): Move earlier, so that it's in scope
      for the new functions.  Use bool for boolean member.
      (SYNTAX_ENTRY, SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH)
      (SYNTAX_TABLE_BYTE_TO_CHAR, UPDATE_SYNTAX_TABLE_FORWARD)
      (UPDATE_SYNTAX_TABLE_BACKWARD, UPDATE_SYNTAX_TABLE)
      (SETUP_BUFFER_SYNTAX_TABLE):
      Now extern inline functions, not macros.
      (CURRENT_SYNTAX_TABLE, SYNTAX_ENTRY_INT):
      Remove; all uses replaced by implementation.
      (syntax_temp) [!__GNUC__]: Remove decl.
      (SETUP_SYNTAX_TABLE_FOR_OBJECT): New decl.
      45b683a1
  2. 21 May, 2013 1 commit
  3. 02 Apr, 2013 1 commit
    • Paul Eggert's avatar
      Prefer < to > in range checks such as 0 <= i && i < N. · 7216e43b
      Paul Eggert authored
      This makes it easier to visualize quantities on a number line.
      This patch doesn't apply to all such range checks,
      only to the range checks affected by the 2013-03-24 change.
      This patch reverts most of the 2013-03-24 change.
      * alloc.c (xpalloc, Fgarbage_collect):
      * ccl.c (ccl_driver, resolve_symbol_ccl_program):
      * character.c (string_escape_byte8):
      * charset.c (read_hex):
      * data.c (cons_to_unsigned):
      * dispnew.c (update_frame_1):
      * doc.c (Fsubstitute_command_keys):
      * doprnt.c (doprnt):
      * editfns.c (hi_time, decode_time_components):
      * fileio.c (file_offset):
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      * font.c (font_intern_prop):
      * frame.c (x_set_alpha):
      * gtkutil.c (get_utf8_string):
      * indent.c (check_display_width):
      * keymap.c (Fkey_description):
      * lisp.h (FIXNUM_OVERFLOW_P, vcopy):
      * lread.c (read1):
      * minibuf.c (read_minibuf_noninteractive):
      * process.c (wait_reading_process_output):
      * search.c (Freplace_match):
      * window.c (get_phys_cursor_glyph):
      * xdisp.c (redisplay_internal):
      * xsmfns.c (smc_save_yourself_CB):
      Prefer < to > for range checks.
      * dispnew.c (sit_for): Don't mishandle NaNs.
      This fixes a bug introduced in the 2013-03-24 change.
      * editfns.c (decode_time_components): Don't hoist comparison.
      This fixes another bug introduced in the 2013-03-24 change.
      7216e43b
  4. 24 Mar, 2013 1 commit
    • Andreas Schwab's avatar
      Reorder conditions that are written backwards · 908589fd
      Andreas Schwab authored
      * alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are
      written backwards.
      * blockinput.h (input_blocked_p): Likewise.
      * bytecode.c (exec_byte_code): Likewise.
      * callproc.c (call_process_kill, call_process_cleanup)
      (Fcall_process): Likewise.
      * ccl.c (ccl_driver, resolve_symbol_ccl_program)
      (Fccl_execute_on_string): Likewise.
      * character.c (string_escape_byte8): Likewise.
      * charset.c (read_hex): Likewise.
      * cm.c (calccost): Likewise.
      * data.c (cons_to_unsigned): Likewise.
      * dired.c (directory_files_internal, file_name_completion):
      Likewise.
      * dispnew.c (scrolling_window, update_frame_1, Fsleep_for)
      (sit_for): Likewise.
      * doc.c (Fsubstitute_command_keys): Likewise.
      * doprnt.c (doprnt): Likewise.
      * editfns.c (hi_time, decode_time_components, Fformat): Likewise.
      * emacsgtkfixed.c: Likewise.
      * fileio.c (file_offset, Fwrite_region): Likewise.
      * floatfns.c (Fexpt, fmod_float): Likewise.
      * fns.c (larger_vector, make_hash_table, Fmake_hash_table):
      Likewise.
      * font.c (font_intern_prop): Likewise.
      * frame.c (x_set_alpha): Likewise.
      * gtkutil.c (get_utf8_string): Likewise.
      * indent.c (check_display_width): Likewise.
      * intervals.c (create_root_interval, rotate_right, rotate_left)
      (split_interval_right, split_interval_left)
      (adjust_intervals_for_insertion, delete_node)
      (interval_deletion_adjustment, adjust_intervals_for_deletion)
      (merge_interval_right, merge_interval_left, copy_intervals)
      (set_intervals_multibyte_1): Likewise.
      * keyboard.c (gobble_input, append_tool_bar_item): Likewise.
      * keymap.c (Fkey_description): Likewise.
      * lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise.
      * lread.c (openp, read_integer, read1, string_to_number):
      Likewise.
      * menu.c (ensure_menu_items): Likewise.
      * minibuf.c (read_minibuf_noninteractive): Likewise.
      * print.c (printchar, strout): Likewise.
      * process.c (create_process, Faccept_process_output)
      (wait_reading_process_output, read_process_output, send_process)
      (wait_reading_process_output): Likewise.
      * profiler.c (make_log, handle_profiler_signal): Likewise.
      * regex.c (re_exec): Likewise.
      * regex.h: Likewise.
      * search.c (looking_at_1, Freplace_match): Likewise.
      * sysdep.c (get_child_status, procfs_ttyname)
      (procfs_get_total_memory): Likewise.
      * systime.h (EMACS_TIME_VALID_P): Likewise.
      * term.c (dissociate_if_controlling_tty): Likewise.
      * window.c (get_phys_cursor_glyph): Likewise.
      * xdisp.c (init_iterator, redisplay_internal, redisplay_window)
      (try_window_reusing_current_matrix, try_window_id, pint2hrstr):
      Likewise.
      * xfns.c (Fx_window_property): Likewise.
      * xmenu.c (set_frame_menubar): Likewise.
      * xselect.c (x_get_window_property, x_handle_dnd_message):
      Likewise.
      * xsmfns.c (smc_save_yourself_CB): Likewise.
      * xterm.c (x_scroll_bar_set_handle): Likewise.
      908589fd
  5. 08 Mar, 2013 2 commits
    • Paul Eggert's avatar
      region-cache.c, scroll.c, search.c: Use bool for booleans. · 457882c2
      Paul Eggert authored
      * lisp.h (compile_pattern):
      * scroll.c (do_scrolling, do_direct_scrolling):
      * search.c (struct regexp_cache, compile_pattern_1)
      (compile_pattern, string_match_1, search_command)
      (trivial_regexp_p, search_buffer, Freplace_match, match_limit)
      (search_regs_saved, Fregexp_quote):
      Use bool for boolean.
      * region-cache.c (region_cache_forward, region_cache_backward):
      Fix comments to match code: these functions return int, not boolean.
      457882c2
    • Dmitry Antipov's avatar
      * search.c (find_newline): Accept start and end byte positions · b5426561
      Dmitry Antipov authored
      as arguments and allow -1 if not known.
      (find_newline_no_quit): Likewise for start position.
      * lisp.h (find_newline, find_newline_no_quit): Adjust prototype.
      * bidi.c (bidi_find_paragraph_start): Pass byte position to
      find_newline_no_quit, thus eliminating CHAR_TO_BYTE.
      * editfns.c (Fconstrain_to_field): Break long line.  Adjust
      call to find_newline.
      * indent.c (vmotion): Adjust calls to find_newline_no_quit.
      Use DEC_BOTH to start next search from the previous buffer
      position, where appropriate.
      * xdisp.c (back_to_previous_line_start, forward_to_next_line_start)
      (get_visually_first_element, move_it_vertically_backward): Likewise.
      Obtain byte position from the display iterator, where appropriate.
      b5426561
  6. 06 Mar, 2013 1 commit
    • Eli Zaretskii's avatar
      Rename find_next_newline to find_newline_no_quit. · a611149e
      Eli Zaretskii authored
       src/search.c (find_newline_no_quit): Rename from find_next_newline.
       Add commentary.
       src/lisp.h (find_newline_no_quit): Rename prototype.
       src/xdisp.c (back_to_previous_line_start)
       (forward_to_next_line_start, get_visually_first_element)
       (move_it_vertically_backward): Callers of find_newline_no_quit changed.
       src/indent.c (vmotion): Callers of find_newline_no_quit changed.
       src/bidi.c (bidi_find_paragraph_start): Callers of
       find_newline_no_quit changed.
      a611149e
  7. 05 Mar, 2013 1 commit
  8. 20 Feb, 2013 1 commit
    • Dmitry Antipov's avatar
      * search.c (find_newline): Return byte position in bytepos. · 2a14a4f1
      Dmitry Antipov authored
      Adjust comment.
      (find_next_newline_no_quit, find_before_next_newline): Add
      bytepos argument.
      * lisp.h (find_newline, find_next_newline_no_quit)
      (find_before_next_newline): Adjust prototypes.
      * bidi.c (bidi_find_paragraph_start):
      * editfns.c (Fconstrain_to_field, Fline_end_position):
      * indent.c (compute_motion, vmotion):
      * xdisp.c (back_to_previous_line_start, forward_to_next_line_start):
      (get_visually_first_element, move_it_vertically_backward):
      Adjust users and avoid calls to CHAR_TO_BYTE where appropriate.
      2a14a4f1
  9. 15 Feb, 2013 1 commit
    • Dmitry Antipov's avatar
      * composite.c (fill_gstring_header): Remove useless prototype. · 0063fdb1
      Dmitry Antipov authored
      Break long line.
      * lisp.h (message_dolog, compile_pattern): Adjust prototype.
      * print.c (PRINTDECLARE, print_object):
      * search.c (compile_pattern, fast_looking_at, search_buffer):
      (simple_search, boyer_moore, Freplace_match):
      * xdisp.c (c_string_pos, number_of_chars, message_dolog):
      (get_overlay_arrow_glyph_row, display_mode_element):
      (decode_mode_spec_coding, message3):
      * xfaces.c (face_at_string_position): Use bool for booleans.
      Adjust comments.
      0063fdb1
  10. 11 Feb, 2013 1 commit
    • Paul Eggert's avatar
      Tune by using memchr and memrchr. · a84b7c53
      Paul Eggert authored
      * .bzrignore: Add string.h.
      * admin/merge-gnulib (GNULIB_MODULES): Add memrchr.
      * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
      * lib/memrchr.c, lib/string.in.h, m4/memrchr.m4, m4/string_h.m4:
      New files, from gnulib.
      * src/doc.c (Fsnarf_documentation):
      * src/fileio.c (Fsubstitute_in_file_name):
      * src/search.c (find_newline, scan_newline):
      * src/xdisp.c (pos_visible_p, display_count_lines):
      Use memchr and memrchr rather than scanning byte-by-byte.
      * src/search.c (find_newline): Rename from scan_buffer.
      Omit first arg TARGET, as it's always '\n'.  All callers changed.
      a84b7c53
  11. 08 Feb, 2013 1 commit
    • Dmitry Antipov's avatar
      * search.c (scan_buffer): Calculate end byte position just once. · 8ca30920
      Dmitry Antipov authored
      (scan_newline): Do not recalculate start_byte.
      (search_command): Use eassert.
      * syntax.c (struct lisp_parse_state): New member location_byte.
      (scan_sexps_forward): Record from_byte and avoid redundant
      character to byte position calculation ...
      (Fparse_partial_sexp): ... here.  Break too long line.
      8ca30920
  12. 01 Jan, 2013 1 commit
  13. 20 Dec, 2012 1 commit
    • Dmitry Antipov's avatar
      Avoid calls to CHAR_TO_BYTE if byte position is known. · 13002885
      Dmitry Antipov authored
      * editfns.c (make_buffer_string_both): Use move_gap_both.
      (Fbuffer_string): Use make_buffer_string_both.
      * marker.c (buf_charpos_to_bytepos): Convert to eassert.
      Adjust comment.
      (buf_bytepos_to_charpos): Likewise.
      (charpos_to_bytepos): Remove.
      * fileio.c (Finsert_file_contents): Use move_gap_both.
      * search.c (Freplace_match): Likewise.
      * process.c (process_send_region): Likewise. Use convenient
      names for byte positions.
      * lisp.h (charpos_to_bytepos): Remove prototype.
      * indent.c (scan_for_column): Use CHAR_TO_BYTE.
      * insdel.c (move_gap): Likewise.
      13002885
  14. 15 Dec, 2012 2 commits
  15. 11 Dec, 2012 1 commit
  16. 10 Oct, 2012 1 commit
    • Paul Eggert's avatar
      keyboard.c, keymap.c: Use bool for booleans. · 9fa1de30
      Paul Eggert authored
      * dispnew.c (sit_for): Distinguish between 3-way display_option
      and boolean do_display.
      * keyboard.c (single_kboard, this_command_key_count_reset)
      (waiting_for_input, echoing, immediate_quit, input_pending)
      (interrupt_input, interrupts_deferred, pop_kboard)
      (temporarily_switch_to_single_kboard, ignore_mouse_drag_p)
      (command_loop_1, adjust_point_for_property)
      (safe_run_hooks_error, input_polling_used, read_char):
      (help_char_p, readable_events, kbd_buffer_events_waiting)
      (kbd_buffer_get_event, timer_check_2, make_lispy_event)
      (lucid_event_type_list_p, get_input_pending):
      (gobble_input, menu_separator_name_p, menu_bar_item)
      (parse_menu_item, parse_tool_bar_item, read_char_x_menu_prompt)
      (read_char_minibuf_menu_prompt, access_keymap_keyremap)
      (keyremap_step, test_undefined, read_key_sequence)
      (detect_input_pending, detect_input_pending_ignore_squeezables)
      (detect_input_pending_run_timers, requeued_events_pending_p)
      (quit_throw_to_read_char, Fset_input_interrupt_mode):
      * keymap.c (get_keymap, keymap_parent, keymap_memberp)
      (access_keymap_1, access_keymap, map_keymap, get_keyelt)
      (Fdefine_key, Flookup_key, struct accessible_keymaps_data)
      (accessible_keymaps_1, Fkey_description, push_key_description):
      (shadow_lookup, struct where_is_internal_data)
      (where_is_internal, Fwhere_is_internal, where_is_internal_1)
      (Fdescribe_buffer_bindings, describe_map_tree, struct describe_map_elt)
      (describe_map, describe_vector):
      * menu.c (single_menu_item):
      * nsmenu.m (ns_update_menubar):
      * process.c (wait_reading_process_output):
      * search.c (scan_buffer, scan_newline):
      Use bool for boolean.
      * keyboard.c (timers_run, swallow_events)
      (detect_input_pending_run_timers):
      * process.c (wait_reading_process_output):
      Use unsigned for counter where wraparound-on-overflow is desired,
      since unsigned is guaranteed to have that behavior and signed is not.
      (read_char): Use ptrdiff_t for string length.
      (get_input_pending): Remove first argument, since it was always
      the same pointer-to-int (now pointer-to-boolean) &input_pending,
      and behave as if it had that value.  Return new value of
      input_pending.  All callers changed.
      * keyboard.h (struct kboard): Use unsigned : 1 for boolean member
      immediate_echo.  Use ptrdiff_t for echo_after_prompt, since it's
      a string length.
      * keymap.c (push_key_description): Omit last arg, which was always 1.
      All callers changed.
      9fa1de30
  17. 23 Sep, 2012 1 commit
    • Paul Eggert's avatar
      Simplify and avoid signal-handling races. · 4d7e6e51
      Paul Eggert authored
      * nt/inc/ms-w32.h (emacs_raise): New macro.
      * src/alloc.c (die):
      * src/sysdep.c (emacs_abort) [HAVE_NTGUI]:
      Avoid recursive loop if there's a fatal error in the function itself.
      * src/atimer.c (pending_atimers):
      * src/blockinput.h: Don't include "atimer.h"; no longer needed.
      (interrupt_input_pending): Remove.  All uses removed.
      pending_signals now counts both atimers and ordinary interrupts.
      This is less racy than having three separate pending-signal flags.
      (block_input, unblock_input, totally_unblock_input, unblock_input_to)
      (input_blocked_p):
      Rename from their upper-case counterparts BLOCK_INPUT,
      UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO,
      INPUT_BLOCKED_P, and turn into functions.  All uses changed.
      This makes it easier to access volatile variables more accurately.
      (BLOCK_INPUT_RESIGNAL): Remove.  All uses replaced by unblock_input ().
      (input_blocked_p): Prefer this to 'interrupt_input_blocked', as
      that's more reliable if the code is buggy and sets
      interrupt_input_blocked to a negative value.  All uses changed.
      * src/atimer.c (deliver_alarm_signal):
      Remove.  No need to deliver this to the parent; any thread can
      handle this signal now.  All uses replaced by underlying handler.
      * src/atimer.c (turn_on_atimers):
      * src/dispnew.c (handle_window_change_signal):
      * src/emacs.c (handle_danger_signal):
      * src/keyboard.c (kbd_buffer_get_event):
      Don't reestablish signal handler; not needed with sigaction.
      * src/blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT)
      (UNBLOCK_INPUT_TO):
      Rework to avoid unnecessary accesses to volatile variables.
      (UNBLOCK_INPUT_TO): Now a function.
      (totally_unblock_input, unblock_input): New decls.
      * src/data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c
      (init_data): Remove.  Necessary stuff now done in init_signal.
      * src/emacs.c, src/xdisp.c: Include "atimer.h", since we invoke atimer functions.
      * src/emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c.
      (fatal_error_code): Remove; no longer needed.
      (terminate_due_to_signal): Rename from fatal_error_backtrace, since
      it doesn't always backtrace.  All uses changed.  No need to reset
      signal to default, since sigaction and/or die does that for us now.
      Use emacs_raise (FOO), not kill (getpid (), FOO).
      (main): Check more-accurately whether we're dumping.
      Move fatal-error setup to sysdep.c
      * src/floatfns.c: Do not include "syssignal.h"; no longer needed.
      * src/gtkutil.c (xg_get_file_name, xg_get_font):
      Remove no-longer-needed signal-mask manipulation.
      * src/keyboard.c, src/process.c (POLL_FOR_INPUT):
      Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined.
      * src/keyboard.c (read_avail_input): Remove.
      All uses replaced by gobble_input.
      (Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code.
      (kbd_buffer_store_event_hold, gobble_input):
      (record_asynch_buffer_change) [USABLE_SIGIO]:
      (store_user_signal_events):
      No need to mess with signal mask.
      (gobble_input): If blocking input and there are terminals, simply
      set pending_signals to 1 and return.  All hooks changed to not
      worry about whether input is blocked.
      (process_pending_signals): Clear pending_signals before processing
      them, in case a signal comes in while we're processing.
      By convention callers now test pending_signals before calling us.
      (UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input):
      New functions, to support changes to blockinput.h.
      (handle_input_available_signal): Now extern.
      (reinvoke_input_signal): Remove.  All uses replaced by
      handle_async_input.
      (quit_count): Now volatile, since a signal handler uses it.
      (handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg.  All
      callers changed.  Block SIGINT only if not already blocked.
      Clear sigmask reliably, even if Fsignal returns, which it can.
      Omit unnecessary accesses to volatile var.
      (quit_throw_to_read_char): No need to restore sigmask.
      * src/keyboard.c (gobble_input, handle_user_signal):
      * src/process.c (wait_reading_process_output):
      Call signal-handling code rather than killing ourselves.
      * src/lisp.h: Include <float.h>, for...
      (IEEE_FLOATING_POINT): New macro, moved here to avoid duplication.
      (pending_signals): Now volatile.
      (syms_of_data): Now const if IEEE floating point.
      (handle_input_available_signal) [USABLE_SIGIO]:
      (terminate_due_to_signal, record_child_status_change): New decls.
      * src/process.c (create_process): Avoid disaster if memory is exhausted
      while we're processing a vfork, by tightening the critical section
      around the vfork.
      (send_process_frame, process_sent_to, handle_pipe_signal)
      (deliver_pipe_signal): Remove.  No longer needed, as Emacs now
      ignores SIGPIPE.
      (send_process): No need for setjmp/longjmp any more, since the
      SIGPIPE stuff is now gone.  Instead, report an error if errno
      is EPIPE.
      (record_child_status_change): Now extern.  PID and W are now args.
      Return void, not bool.  All callers changed.
      * src/sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]:
      Remove.  All uses removed.  This bug should be fixed now in a
      different way.
      (wait_for_termination_1): Use waitpid rather than sigsuspend,
      and record the child status change directly.  This avoids the
      need to futz with the signal mask.
      (process_fatal_action): Move here from emacs.c.
      (emacs_sigaction_flags): New function, containing
      much of what used to be in emacs_sigaction_init.
      (emacs_sigaction_init): Use it.  Block nonfatal system signals that are
      caught by emacs, to make races less likely.
      (deliver_process_signal): Rename from handle_on_main_thread.
      All uses changed.
      (BACKTRACE_LIMIT_MAX): Now at top level.
      (thread_backtrace_buffer, threadback_backtrace_pointers):
      New static vars.
      (deliver_thread_signal, deliver_fatal_thread_signal):
      New functions, for more-accurate delivery of thread-specific signals.
      (handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c.
      (deliver_arith_signal): Handle in this thread, not
      in the main thread, since it's triggered by this thread.
      (maybe_fatal_sig): New function.
      (init_signals): New arg DUMPING so that we can be more accurate
      about whether we're dumping.  Caller changed.
      Treat thread-specific signals differently from process-general signals.
      Block all signals while handling fatal error; that's safer.
      xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal
      on IEEE hosts.
      When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored.
      Ignore SIGPIPE unless batch.
      (emacs_backtrace): Output backtrace for the appropriate thread,
      which is not necessarily the main thread.
      * src/syssignal.h: Include <stdbool.h>.
      (emacs_raise): New macro.
      * src/xterm.c (x_connection_signal): Remove; no longer needed
      now that we use sigaction.
      (x_connection_closed): No need to mess with sigmask now.
      (x_initialize): No need to reset SIGPIPE handler here, since
      init_signals does this for us now.
      
      Fixes: debbugs:12471
      4d7e6e51
  18. 22 Sep, 2012 1 commit
    • Chong Yidong's avatar
      Misc doc fixes. · c88b867f
      Chong Yidong authored
      * searching.texi (Replacing Match): Minor clarification.
      
      * lisp/repeat.el (repeat): Doc fix.
      
      * lisp/simple.el (shell-command-on-region): Doc fix.
      
      * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix.
      
      * cmds.c (Fforward_char, Fbackward_char): Doc fix.
      
      * editfns.c (Fline_beginning_position): Doc fix.
      (Fline_end_position): Doc fix.
      
      * minibuf.c (Finternal_complete_buffer): Doc fix.
      
      * search.c (Freplace_match): Doc fix.
      
      Fixes: debbugs:12325 debbugs:12391 debbugs:12416 debbugs:12414 debbugs:10909 debbugs:12348
      c88b867f
  19. 17 Sep, 2012 1 commit
  20. 15 Sep, 2012 1 commit
    • Paul Eggert's avatar
      Port better to POSIX hosts lacking _setjmp. · 0328b6de
      Paul Eggert authored
      * configure.ac (HAVE__SETJMP, HAVE_SIGSETJMP): New symbols.
      (_setjmp, _longjmp): Remove.
      * src/lisp.h: Include <setjmp.h> here, since we use its symbols here.
      All instances of '#include <setjmp.h>' removed, if the
      only reason for the instance was because "lisp.h" was included.
      (sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols.
      Unless otherwise specified, replace all uses of jmp_buf, _setjmp,
      and _longjmp with the new symbols.  Emacs already uses _setjmp if
      available, so this change affects only POSIXish hosts that have
      sigsetjmp but not _setjmp, such as some versions of Solaris and
      Unixware.  (Also, POSIX-2008 marks _setjmp as obsolescent.)
      * src/image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros.
      (png_load_body) [HAVE_PNG]:
      (PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]:
      (PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]:
      Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp,
      since PNG requires jmp_buf.  This is the only exception to the
      general rule that we now use sys_setjmp and sys_longjmp.
      This exception is OK since this code does not change the signal
      mask or longjmp out of a signal handler.
      
      Fixes: debbugs:12446
      0328b6de
  21. 04 Sep, 2012 1 commit
    • Paul Eggert's avatar
      Simplify redefinition of 'abort' (Bug#12316). · 1088b922
      Paul Eggert authored
      Do not try to redefine the 'abort' function.  Instead, redo
      the code so that it calls 'emacs_abort' rather than 'abort'.
      This removes the need for the NO_ABORT configure-time macro
      and makes it easier to change the abort code to do a backtrace.
      * configure.ac (NO_ABRT): Remove.
      * admin/CPP-DEFINES (NO_ABORT): Remove.
      * nt/inc/ms-w32.h (w32_abort) [HAVE_NTGUI]: Remove.
      * src/.gdbinit: Just stop at emacs_abort, not at w32_abort or abort.
      * src/emacs.c (abort) [!DOS_NT && !NO_ABORT]:
      Remove; sysdep.c's emacs_abort now takes its place.
      * src/lisp.h (emacs_abort): New decl.  All calls from Emacs code to
      'abort' changed to use 'emacs_abort'.
      * src/msdos.c (dos_abort) [defined abort]: Remove; not used.
      (abort) [!defined abort]: Rename to ...
      (emacs_abort): ... new name.
      * src/sysdep.c (emacs_abort) [!HAVE_NTGUI]: New function, taking
      the place of the old 'abort' in emacs.c.
      * src/w32.c, src/w32fns.c (abort): Do not #undef.
      * src/w32.c (emacs_abort): Rename from w32_abort.
      1088b922
  22. 17 Aug, 2012 1 commit
  23. 16 Aug, 2012 1 commit
  24. 05 Aug, 2012 1 commit
  25. 27 Jul, 2012 2 commits
    • Eli Zaretskii's avatar
      Fix failure to compile on Windows due to 2012-07-27T06:04:35Z!dmantipov@yandex.ru. · 3438fe21
      Eli Zaretskii authored
       src/lisp.h (enum constype): Use CONSTYPE_HEAP and CONSTYPE_PURE for
       enumeration constants, as PURE and HEAP are too general, and clash
       with other headers and sources, such as gmalloc.c and the
       MS-Windows system headers.  All users changed.
      3438fe21
    • Dmitry Antipov's avatar
      Utility function to make a list from specified amount of objects. · 694b6c97
      Dmitry Antipov authored
      * lisp.h (enum constype): New datatype.
      (listn): New prototype.
      * alloc.c (listn): New function.
      (Fmemory_use_count, syms_of_alloc): Use it.
      * buffer.c (syms_of_buffer): Likewise.
      * callint.c (syms_of_callint): Likewise.
      * charset.c (define_charset_internal): Likewise.
      * coding.c (syms_of_coding): Likewise.
      * keymap.c (syms_of_keymap): Likewise.
      * search.c (syms_of_search): Likewise.
      * syntax.c (syms_of_syntax): Likewise.
      * w32.c (init_environment): Likewise.
      * w32fns.c (Fw32_battery_status, syms_of_w32fns): Likewise.
      * xdisp.c (syms_of_xdisp): Likewise.
      * xfns.c (syms_of_xfns): Likewise.
      694b6c97
  26. 11 Jul, 2012 1 commit
  27. 10 Jul, 2012 1 commit
    • Dmitry Antipov's avatar
      Optimize pure C strings initialization. · 2a0213a6
      Dmitry Antipov authored
      * lisp.h (make_pure_string): Fix prototype.
      (build_pure_c_string): New function, defined as static inline.  This
      provides a better opportunity to optimize away calls to strlen when
      the function is called with compile-time constant argument.
      * alloc.c (make_pure_c_string): Fix comment.  Change to add nchars
      argument, adjust users accordingly.  Use build_pure_c_string where
      appropriate.
      * buffer.c, coding.c, data.c, dbusbind.c, fileio.c, fontset.c, frame.c,
      * keyboard.c, keymap.c, lread.c, search.c, syntax.c, w32fns.c, xdisp.c,
      * xfaces.c, xfns.c, xterm.c: Use build_pure_c_string where appropriate.
      2a0213a6
  28. 05 Jul, 2012 2 commits
    • Paul Eggert's avatar
      More xmalloc and related cleanup. · 38182d90
      Paul Eggert authored
      * alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c:
      * callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c:
      * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c:
      * font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c:
      * gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c:
      * nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c:
      * regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c:
      * sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c:
      * xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c:
      * xterm.c:
      Omit needless casts involving void * pointers and allocation.
      Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))",
      as the former is more robust if P's type is changed.
      Prefer xzalloc to xmalloc + memset 0.
      Simplify malloc-or-realloc to realloc.
      Don't worry about xmalloc returning a null pointer.
      Prefer xstrdup to xmalloc + strcpy.
      * editfns.c (Fmessage_box): Grow message_text by at least 80 when
      growing it.
      * keyboard.c (apply_modifiers_uncached): Prefer local array to
      alloca of a constant.
      38182d90
    • Dmitry Antipov's avatar
      Cleanup xmalloc. · 23f86fce
      Dmitry Antipov authored
      * admin/coccinelle/xzalloc.cocci: Semantic patch to convert
      calls to xmalloc with following memset to xzalloc.
      * src/lisp.h (xzalloc): New prototype.  Omit needless casts.
      * src/alloc.c (xzalloc): New function.  Omit needless casts.
      * src/charset.c: Omit needless casts.  Convert all calls to
      malloc with following memset to xzalloc.
      * src/dispnew.c: Likewise.
      * src/fringe.c: Likewise.
      * src/image.c: Likewise.
      * src/sound.c: Likewise.
      * src/term.c: Likewise.
      * src/w32fns.c: Likewise.
      * src/w32font.c: Likewise.
      * src/w32term.c: Likewise.
      * src/xfaces.c: Likewise.
      * src/xfns.c: Likewise.
      * src/xterm.c: Likewise.
      * src/atimer.c: Omit needless casts.
      * src/buffer.c: Likewise.
      * src/callproc.c: Likewise.
      * src/ccl.c: Likewise.
      * src/coding.c: Likewise.
      * src/composite.c: Likewise.
      * src/doc.c: Likewise.
      * src/doprnt.c: Likewise.
      * src/editfns.c: Likewise.
      * src/emacs.c: Likewise.
      * src/eval.c: Likewise.
      * src/filelock.c: Likewise.
      * src/fns.c: Likewise.
      * src/gtkutil.c: Likewise.
      * src/keyboard.c: Likewise.
      * src/lisp.h: Likewise.
      * src/lread.c: Likewise.
      * src/minibuf.c: Likewise.
      * src/msdos.c: Likewise.
      * src/print.c: Likewise.
      * src/process.c: Likewise.
      * src/region-cache.c: Likewise.
      * src/search.c: Likewise.
      * src/sysdep.c: Likewise.
      * src/termcap.c: Likewise.
      * src/terminal.c: Likewise.
      * src/tparam.c: Likewise.
      * src/w16select.c: Likewise.
      * src/w32.c: Likewise.
      * src/w32reg.c: Likewise.
      * src/w32select.c: Likewise.
      * src/w32uniscribe.c: Likewise.
      * src/widget.c: Likewise.
      * src/xdisp.c: Likewise.
      * src/xmenu.c: Likewise.
      * src/xrdb.c: Likewise.
      * src/xselect.c: Likewise.
      23f86fce
  29. 04 Jul, 2012 1 commit
    • Dmitry Antipov's avatar
      Fix compilation with --enable-gcc-warnings and -O1 · 8ce70ed2
      Dmitry Antipov authored
      optimization level.
      * configure.in: If --enable-gcc-warnings, disable
      -Wunsafe-loop-optimizations for -O1 optimization level.
      * src/doprnt.c (doprnt): Change type of tem to int, initialize
      to avoid compiler warning.  Add eassert.
      * src/search.c (simple_search): Initialize match_byte to avoid
      compiler warning.  Add eassert.
      8ce70ed2
  30. 24 Jun, 2012 1 commit
  31. 16 Jun, 2012 1 commit
    • Andreas Schwab's avatar
      * buffer.h (FETCH_MULTIBYTE_CHAR): Define as inline. · e5560ff7
      Andreas Schwab authored
      (BUF_FETCH_MULTIBYTE_CHAR): Likewise.
      * character.c (_fetch_multibyte_char_p): Remove.
      * alloc.c: Include "character.h" before "buffer.h".
      * bidi.c: Likewise.
      * buffer.c: Likewise.
      * bytecode.c: Likewise.
      * callint.c: Likewise.
      * callproc.c: Likewise.
      * casefiddle.c: Likewise.
      * casetab.c: Likewise.
      * category.c: Likewise.
      * cmds.c: Likewise.
      * coding.c: Likewise.
      * composite.c: Likewise.
      * dired.c: Likewise.
      * dispnew.c: Likewise.
      * doc.c: Likewise.
      * dosfns.c: Likewise.
      * editfns.c: Likewise.
      * emacs.c: Likewise.
      * fileio.c: Likewise.
      * filelock.c: Likewise.
      * font.c: Likewise.
      * fontset.c: Likewise.
      * fringe.c: Likewise.
      * indent.c: Likewise.
      * insdel.c: Likewise.
      * intervals.c: Likewise.
      * keyboard.c: Likewise.
      * keymap.c: Likewise.
      * lread.c: Likewise.
      * macros.c: Likewise.
      * marker.c: Likewise.
      * minibuf.c: Likewise.
      * nsfns.m: Likewise.
      * nsmenu.m: Likewise.
      * print.c: Likewise.
      * process.c: Likewise.
      * regex.c: Likewise.
      * region-cache.c: Likewise.
      * search.c: Likewise.
      * syntax.c: Likewise.
      * term.c: Likewise.
      * textprop.c: Likewise.
      * undo.c: Likewise.
      * unexsol.c: Likewise.
      * w16select.c: Likewise.
      * w32fns.c: Likewise.
      * w32menu.c: Likewise.
      * window.c: Likewise.
      * xdisp.c: Likewise.
      * xfns.c: Likewise.
      * xmenu.c: Likewise.
      * xml.c: Likewise.
      * xselect.c: Likewise.
      e5560ff7
  32. 29 May, 2012 1 commit
  33. 23 May, 2012 1 commit
    • Eli Zaretskii's avatar
      Fix bug #11519 with relocation of buffer text during regex search. · 52c55cc7
      Eli Zaretskii authored
       src/lisp.h [REL_ALLOC]: Add prototypes for external functions
       defined on ralloc.c.
       src/buffer.c [REL_ALLOC]: Remove prototypes of
       r_alloc_reset_variable, r_alloc, r_re_alloc, and r_alloc_free,
       they are now on lisp.h.
       src/ralloc.c (r_alloc_inhibit_buffer_relocation): New function.
       src/search.c (search_buffer): Use it to inhibit relocation of buffer
       text while re_search_2 is doing its job, because re_search_2 is
       passed C pointers to buffer text.
      52c55cc7
  34. 17 May, 2012 1 commit
    • Juri Linkov's avatar
      Move word search functions from search.c to isearch.el (bug#10145, bug#11381). · a0a79cde
      Juri Linkov authored
      * lisp/isearch.el (word-search-regexp, word-search-backward)
      (word-search-forward, word-search-backward-lax)
      (word-search-forward-lax): Move functions from search.c.
      
      * src/search.c (Fword_search_regexp, Fword_search_backward)
      (Fword_search_forward, Fword_search_backward_lax)
      (Fword_search_forward_lax): Move functions to isearch.el.
      a0a79cde
  35. 27 Mar, 2012 1 commit
    • Glenn Morris's avatar
      Small doc and elisp manual fixes related to searching · 4fb9a543
      Glenn Morris authored
      * doc/lispref/searching.texi (String Search): Add xref to Emacs manual.
      Copyedits.  Mention the function word-search-regexp.
      (Searching and Case): Add xref to Emacs manual.  Copyedits.
      
      * src/search.c (Fword_search_backward_lax, Fword_search_forward_lax):
      Doc fixes.
      4fb9a543
  36. 26 Jan, 2012 1 commit