1. 01 Aug, 2020 1 commit
  2. 19 Apr, 2020 1 commit
  3. 18 Apr, 2020 1 commit
  4. 17 Apr, 2020 1 commit
    • Paul Eggert's avatar
      Prefer more inline functions in character.h · 27d10183
      Paul Eggert authored
      * src/buffer.h (fetch_char_advance, fetch_char_advance_no_check)
      (buf_next_char_len, next_char_len, buf_prev_char_len)
      (prev_char_len, inc_both, dec_both): New inline functions,
      replacing the old character.h macros FETCH_CHAR_ADVANCE,
      FETCH_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS, INC_POS, BUF_DEC_POS,
      DEC_POS, INC_BOTH, DEC_BOTH respectively.  All callers changed.
      These new functions all assume buffer primitives and so need
      to be here rather than in character.h.
      * src/casefiddle.c (make_char_unibyte): New static function,
      replacing the old MAKE_CHAR_UNIBYTE macro.  All callers changed.
      (do_casify_unibyte_string): Use SINGLE_BYTE_CHAR_P instead
      of open-coding it.
      * src/ccl.c (GET_TRANSLATION_TABLE): New static function,
      replacing the old macro of the same name.
      * src/character.c (string_char): Omit 2nd arg.  3rd arg can no
      longer be NULL.  All callers changed.
      * src/character.h (SINGLE_BYTE_CHAR_P): Move up.
      (MAKE_CHAR_UNIBYTE, MAKE_CHAR_MULTIBYTE, PREV_CHAR_BOUNDARY)
      (STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE)
      (FETCH_STRING_CHAR_ADVANCE)
      (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
      (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
      (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
      (DEC_BOTH, BUF_INC_POS, BUF_DEC_POS): Remove.
      (make_char_multibyte): New static function, replacing
      the old macro MAKE_CHAR_MULTIBYTE.  All callers changed.
      (CHAR_STRING_ADVANCE): Remove; all callers changed to use
      CHAR_STRING.
      (NEXT_CHAR_BOUNDARY): Remove; it was unused.
      (raw_prev_char_len): New inline function, replacing the
      old PREV_CHAR_BOUNDARY macro.  All callers changed.
      (string_char_and_length): New inline function, replacing the
      old STRING_CHAR_AND_LENGTH macro.  All callers changed.
      (STRING_CHAR): Rewrite in terms of string_char_and_length.
      (string_char_advance): New inline function, replacing the old
      STRING_CHAR_ADVANCE macro.  All callers changed.
      (fetch_string_char_advance): New inline function, replacing the
      old FETCH_STRING_CHAR_ADVANCE macro.  All callers changed.
      (fetch_string_char_as_multibyte_advance): New inline function,
      replacing the old FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE macro.
      All callers changed.
      (fetch_string_char_advance_no_check): New inline function,
      replacing the old FETCH_STRING_CHAR_ADVANCE_NO_CHECK macro.  All
      callers changed.
      * src/regex-emacs.c (HEAD_ADDR_VSTRING): Remove; no longer used.
      * src/syntax.c (scan_lists): Use dec_bytepos instead of
      open-coding it.
      * src/xdisp.c (string_char_and_length): Rename from
      string_char_and_length to avoid name conflict with new function in
      character.h.  All callers changed.
      27d10183
  5. 17 Mar, 2020 1 commit
    • Mattias Engdegård's avatar
      Don't generate useless range table entries for ASCII chars · f189e5dc
      Mattias Engdegård authored
      In multibyte regexps, each ASCII char or range in a character
      alternative produces a nonsense range table entry in addition to the
      correct bits in the ASCII bitmap.  Those entries do not match anything
      but waste space and time.
      
      * src/regex-emacs.c (regex_compile): Don't generate reversed intervals.
      f189e5dc
  6. 27 Feb, 2020 2 commits
  7. 26 Feb, 2020 2 commits
  8. 09 Feb, 2020 1 commit
    • Alan Mackenzie's avatar
      Correct "different than" to "different from" where appropriate · 53006746
      Alan Mackenzie authored
      (doc/emacs/screen.texi)
      (doc/lispintro/emacs-lisp-intro.texi)
      (doc/misc/calc.texi)
      (doc/misc/gnus.texi)
      (doc/misc/sc.texi)
      (lisp/align.el)
      (lisp/allout-widgets.el)
      (lisp/allout.el)
      (lisp/emacs-lisp/gv.el)
      (lisp/font-lock.el)
      (lisp/gnus/mm-util.el)
      (lisp/mail/feedmail.el)
      (lisp/mail/sendmail.el)
      (lisp/mail/supercite.el)
      (lisp/org/org-attach.el)
      (lisp/progmodes/cc-langs.el)
      (lisp/progmodes/idlw-shell.el)
      (lisp/ps-print.el)
      (lisp/simple.el)
      (src/cmds.c)
      (src/editfns.c)
      (src/frame.h)
      (src/regex-emacs.c)
      (src/xfaces.c): Replace "different than" by "different from".
      53006746
  9. 01 Jan, 2020 1 commit
  10. 09 Jul, 2019 1 commit
    • Paul Eggert's avatar
      Use fewer locks when accessing stdio · f8ab9083
      Paul Eggert authored
      * src/alloc.c, src/bidi.c, src/emacs-module.c, src/pdumper.c:
      * src/regex-emacs.c, src/unexhp9k800.c, src/unexmacosx.c:
      * src/widget.c, src/xdisp.c, src/xselect.c, src/xterm.c:
      Include sysstdio.h instead of stdio.h, to avoid locking
      stdio streams in many cases.
      * src/alloc.c (test_setjmp):
      * src/bidi.c (bidi_dump_cached_states):
      * src/cm.c (calccost):
      * src/dispnew.c (init_display_interactive):
      * src/emacs.c (main):
      * src/image.c (convert_mono_to_color_image):
      * src/minibuf.c (read_minibuf_noninteractive):
      * src/nsfont.m (ns_descriptor_to_entity)
      (ns_dump_glyphstring):
      * src/nsterm.h (NSTRACE_MSG_NO_DASHES):
      * src/nsterm.m (ns_mouse_position)
      (sendEvent:, keyDown:, performDragOperation:):
      * src/pdumper.c (dump_fingerprint, print_paths_to_root_1):
      * src/print.c (debug_print):
      * src/regex-emacs.c (debug_putchar, print_fastmap)
      (print_partial_compiled_pattern, print_compiled_pattern)
      (print_double_string, regex_compile):
      * src/term.c (vfatal):
      * src/unexhp9k800.c (read_header):
      * src/unexmacosx.c (unexec_error):
      * src/widget.c (EmacsFrameInitialize):
      * src/xdisp.c (message_to_stderr, vmessage, dump_glyph_row)
      (Fdump_glyph_matrix, Fdump_frame_glyph_matrix, dump_glyph_string):
      * src/xfaces.c (Fdump_colors, Fdump_face):
      * src/xselect.c (x_clipboard_manager_error_2):
      * src/xterm.c (x_initialize):
      * src/xwidget.c (WEBKIT_FN_INIT):
      Prefer unlocked calls like fputs to locked calls like fprintf.
      * src/charset.c (read_hex):
      * src/cm.c (cmputc, cmcheckmagic):
      * src/dispnew.c (update_frame, update_frame_with_menu)
      (update_frame_1, Fsend_string_to_terminal, Fding)
      (bitch_at_user):
      * src/emacs.c (main, Fdump_emacs):
      * src/emacs-module.c (module_abort):
      * src/fileio.c (Fdo_auto_save):
      * src/image.c (slurp_file)
      (png_read_from_file, png_load_body, our_stdio_fill_input_buffer):
      * src/keyboard.c (record_char, kbd_buffer_get_event)
      (handle_interrupt):
      * src/lread.c (readbyte_from_stdio, read1):
      * src/minibuf.c (read_minibuf_noninteractive):
      * src/print.c (printchar_to_stream, strout)
      (Fredirect_debugging_output):
      * src/sysdep.c (reset_sys_modes, close_output_streams)
      (procfs_ttyname, procfs_get_total_memory):
      * src/term.c (tty_ring_bell, tty_send_additional_strings)
      (tty_set_terminal_modes, tty_reset_terminal_modes)
      (tty_update_end, tty_clear_end_of_line, tty_write_glyphs)
      (tty_write_glyphs_with_face, tty_insert_glyphs)
      (tty_menu_activate):
      * src/xfaces.c (Fx_load_color_file):
      Simplify by using ordinary calls like putc to explicitly-unlocked
      calls like putc_unlocked, since the ordinary calls are now
      unlocked anyway.
      * src/emacs.c (main, Fdump_emacs):
      * src/pdumper.c (Fdump_emacs_portable):
      Coalesce adjacent printfs.
      * src/nsterm.h: Include sysstdio.h as this file’s macros rely on it.
      * src/regex-emacs.c (print_compiled_pattern):
      Omit redundant fflush.
      * src/sysstdio.h: Include unlocked-io.h.
      (clearerr_unlocked, feof_unlocked, ferror_unlocked)
      (fflush_unlocked, fgets_unlocked, fputc_unlocked)
      (fputs_unlocked, fread_unlocked, fwrite_unlocked)
      (getc_unlocked, getchar_unlocked, putc_unlocked)
      (putchar_unlocked): Remove these macros; now done by unlocked-io.h.
      * src/xwidget.c: Include sysstdio.h.
      f8ab9083
  11. 02 Jul, 2019 1 commit
    • Paul Eggert's avatar
      Fix regex-emacs debug format glitches · b35f378d
      Paul Eggert authored
      These patches affect behavior only if REGEX_EMACS_DEBUG.
      * src/regex-emacs.c (debug_putchar): Use unsigned for %x.
      (print_compiled_pattern, ENSURE_FAIL_STACK, PUSH_FAILURE_POINT)
      (POP_FAILURE_POINT): Use %td for ptrdiff_t.
      (print_compiled_pattern, regex_compile, re_match_2_internal):
      Put newlines at ends of lines, not at starts of next lines.
      Omit white space at line ends.
      b35f378d
  12. 28 Jun, 2019 3 commits
    • Mattias Engdegård's avatar
      Correct regexp matching of raw bytes · a1f76adf
      Mattias Engdegård authored
      Make regexp matching of raw bytes work in all combination of unibyte
      and multibyte patterns and targets, as exact strings and in character
      alternatives (bug#3687).
      
      * src/regex-emacs.c (analyze_first):
      Include raw byte in fastmap when pattern is a multibyte exact string.
      Include leading byte in fastmap for raw bytes in character alternatives.
      (re_match_2_internal):
      Decrement the byte count by the number of bytes in the pattern character,
      not 1.
      * test/src/regex-emacs-tests.el (regexp-unibyte-unibyte)
      (regexp-multibyte-unibyte, regexp-unibyte-mutibyte)
      (regexp-multibyte-multibyte): New tests.
      a1f76adf
    • Mattias Engdegård's avatar
      More readable regexp debug output · 24a32960
      Mattias Engdegård authored
      * src/regex-emacs.c (debug_putchar): New.
      (print_fastmap, print_partial_compiled_pattern, print_double_string)
      (regex_compile): Use debug_putchar.
      (re_match_2_internal): Add newline.
      24a32960
    • Mattias Engdegård's avatar
      Consistently use stderr for debug output in regexp code · 82172558
      Mattias Engdegård authored
      * src/regex-emacs.c (DEBUG_PRINT, print_fastmap, print_compiled_pattern)
      (print_double_string, regex_compile): Print to stderr instead of stdout.
      82172558
  13. 23 May, 2019 1 commit
    • Paul Eggert's avatar
      Avoid backslash-newline-newline in source code · 54244364
      Paul Eggert authored
      * etc/refcards/Makefile (PDF_FRENCH):
      * lib-src/etags.c (LOOP_ON_INPUT_LINES):
      * lisp/dabbrev.el (dabbrev-check-other-buffers):
      * lisp/org/org-id.el (org-id-link-to-org-use-id):
      * lisp/org/org.el (org-support-shift-select, org-file-apps):
      * src/alloc.c (CHECK_ALLOCATED_AND_LIVE)
      (CHECK_ALLOCATED_AND_LIVE_SYMBOL):
      * src/frame.h (FRAME_PIXEL_WIDTH_TO_TEXT_COLS):
      * src/regex-emacs.c (PREFETCH_NOLIMIT):
      * src/window.h (WINDOW_BUFFER):
      Remove backslash-newline that immediately precedes another
      newline, as this is not the usual style and is confusing.
      54244364
  14. 28 Mar, 2019 1 commit
    • Paul Eggert's avatar
      Tweak re_registers allocation · 81795bb7
      Paul Eggert authored
      * src/regex-emacs.c (re_match_2_internal):
      No need to allocate one extra trailing search register;
      Emacs does not use it.  Avoid quadratic behavior on
      reallocation.
      81795bb7
  15. 25 Mar, 2019 2 commits
    • Paul Eggert's avatar
      Fix some integer issues in regex-emacs · b7a98993
      Paul Eggert authored
      Also, remove some duplicate comments related to thread.h.
      * src/regex-emacs.h (struct re_registers):
      * src/regex-emacs.c (SIGN_EXTEND_CHAR): Remove.
      (TALLOC, RETALLOC): Remove.  All uses replaced by usual
      allocators, which check for integer overflow.
      (extract_number): Redo without using ‘unsigned’.
      (CHARSET_RANGE_TABLE_EXISTS_P): Clearly return a boolean.
      (print_fastmap, print_partial_compiled_pattern, CHECK_INFINITE_LOOP)
      (regex_compile, analyze_first, bcmp_translate, mutually_exclusive_p)
      (re_match_2_internal):
      Use bool for booleans.
      (print_fastmap, regex_compile, execute_charset):
      Prefer int to unsigned where either will do.
      (print_double_string): Prefer ptrdiff_t to ssize_t, since the
      latter can in theory be narrower than the former.  Use fwrite
      instead of repeated putchar.
      (emacs_re_max_failures, fail_stack_type, compile_stack_type)
      (re_wctype_parse, regex_compile, re_search, re_search_2)
      (re_match_2, re_match_2_internal, re_compile_pattern):
      Prefer ptrdiff_t to size_t where either will do.
      (union fail_stack_elt, PUSH_FAILURE_REG, POP_FAILURE_REG_OR_COUNT):
      Make the integer an intptr_t, not long.
      (GET_BUFFER_SPACE, EXTEND_BUFFER, regex_compile):
      Use xpalloc to simplify allocation.
      (regex_compile): Check for integer overflow when calculating
      register numbers.
      * src/regex-emacs.c (re_set_registers, re_match_2_internal):
      * src/regex-emacs.h (struct re_registers, struct re_pattern_buffer):
      * src/search.c (Freplace_match):
      Prefer ptrdiff_t to unsigned where either will do.
      * src/regex-emacs.h (struct re_pattern_buffer):
      Prefer bool_bf to unsigned where either will do.
      b7a98993
    • Paul Eggert's avatar
      176ababa
  16. 01 Mar, 2019 1 commit
    • Alan Mackenzie's avatar
      Maintain interval ->position fields correctly in update_interval · 31182c1d
      Alan Mackenzie authored
      Also fix some anomalies in the handling of byte positions in regexp-emacs.c
      This fixes bug #34525.
      
      * src/intervals.c (SET_PARENT_POSITION): New macro.
      (update_interval): When moving to an interval's parent, set that parent's
      ->position field, to maintain the consistency of the tree.
      
      * src/intervals.h (struct interval): Amend the comment describing when
      ->position is valid.
      
      * src/pdumper.c: Update the hash associated with struct interval.
      
      * src/regex-emacs.c: (re_match_2_internal): Only invoke POINTER_TO_OFFSET on a
      known character boundary.  Only perform arithmetic on character positions, not
      on byte positions.  Correct the argument to an invocation of
      UPDATE_SYNTAX_TABLE_FORWARD by adding 1 to it (in case wordend:).
      
      * src/syntax.c: (update_syntax_table): Remove the now redundant code that set
      the ->position field of all parents of the interval found by update_interval.
      31182c1d
  17. 17 Dec, 2018 1 commit
    • Paul Eggert's avatar
      Assume ‘emacs’ is defined in Emacs-only code · 4d77c4ac
      Paul Eggert authored
      * src/charset.c, src/coding.c, src/coding.h, src/gmalloc.c:
      * src/ralloc.c, src/regex-emacs.c: Simplify slightly by
      assuming that ‘emacs’ is defined.  These modules have long
      been specific to Emacs, and are not used elsewhere.
      4d77c4ac
  18. 06 Aug, 2018 5 commits
    • Paul Eggert's avatar
      Spruce up some regex-emacs comments · 9c022a48
      Paul Eggert authored
      * src/regex-emacs.c, src/regex-emacs.h: Update comments.
      9c022a48
    • Paul Eggert's avatar
      Remove always-0 struct re_pattern_buffer members · e097826f
      Paul Eggert authored
      * src/regex-emacs.h (struct re_pattern_buffer):
      Remove no_sub, not_bol, not_eol.  They are always zero.
      All uses removed, and code simplified.
      e097826f
    • Paul Eggert's avatar
      Simplify regex-emacs by assuming Emacs syntax · 03dfb606
      Paul Eggert authored
      * src/regex-emacs.c (reg_syntax_t)
      (RE_BACKSLASH_ESCAPE_IN_LISTS, RE_BK_PLUS_QM)
      (RE_CHAR_CLASSES, RE_CONTEXT_INDEP_ANCHORS)
      (RE_CONTEXT_INDEP_OPS, RE_CONTEXT_INVALID_OPS)
      (RE_DOT_NEWLINE, RE_DOT_NOT_NULL, RE_HAT_LISTS_NOT_NEWLINE)
      (RE_INTERVALS, RE_LIMITED_OPS, RE_NEWLINE_ALT)
      (RE_NO_BK_BRACES, RE_NO_BK_PARENS, RE_NO_BK_REFS)
      (RE_NO_BK_VBAR, RE_NO_EMPTY_RANGES)
      (RE_UNMATCHED_RIGHT_PAREN_ORD, RE_NO_POSIX_BACKTRACKING)
      (RE_NO_GNU_OPS, RE_FRUGAL, RE_SHY_GROUPS)
      (RE_NO_NEWLINE_ANCHOR, RE_SYNTAX_EMACS, RE_TRANSLATE_P):
      Remove.  All uses removed and resulting code simplified.
      (TRANSLATE): Treat nil as an absent translation table, not zero.
      All uses changed.
      03dfb606
    • Paul Eggert's avatar
      Simplify regex-emacs code by assuming Emacs · 3a6abe65
      Paul Eggert authored
      * src/regex-emacs.c: Omit no-longer-needed AIX code.
      Don’t ignore GCC warnings.
      Include regex-emacs.h immediately after config.h,
      to test that it’s independent.
      Omit the "#ifndef emacs" and "#ifdef REGEX_MALLOC" and
      "#if WIDE_CHAR_SUPPORT" or "#ifdef _REGEX_RE_COMP",
      code, as we are no longer interested in compiling outside
      Emacs (with or without debugging or native wide char support)
      or in avoiding alloca.
      (REGEX_EMACS_DEBUG, regex_emacs_debug): Rename from DEBUG and debug,
      to avoid collision with other DEBUGS.  All uses changed.
      In debugging output, change %ld and %zd to %zu when appropriate.
      No need to include stddef.h, stdlib.h, sys/types.h, wchar.h,
      wctype.h, locale/localeinfo.h, locale/elem-hash.h, langinfo.h,
      libintl.h, unistd.h, stdbool.h, string.h, stdio.h, assert.h.
      All uses of assert changed to eassert.
      (RE_DUP_MAX, reg_syntax_t, RE_BACKSLASH_ESCAPE_IN_LISTS)
      (RE_BK_PLUS_QM, RE_CHAR_CLASSES, RE_CONTEXT_INDEP_ANCHORS)
      (RE_CONTEXT_INDEP_OPS, RE_CONTEXT_INVALID_OPS, RE_DOT_NEWLINE)
      (RE_DOT_NOT_NULL, RE_HAT_LISTS_NOT_NEWLINE, RE_INTERVALS)
      (RE_LIMITED_OPS, RE_NEWLINE_ALT, RE_NO_BK_BRACES)
      (RE_NO_BK_PARENS, RE_NO_BK_REFS, RE_NO_BK_VBAR)
      (RE_NO_EMPTY_RANGES, RE_UNMATCHED_RIGHT_PAREN_ORD)
      (RE_NO_POSIX_BACKTRACKING, RE_NO_GNU_OPS, RE_FRUGAL)
      (RE_SHY_GROUPS, RE_NO_NEWLINE_ANCHOR, RE_SYNTAX_EMACS)
      (REG_NOERROR, REG_NOMATCH, REG_BADPAT, REG_ECOLLATE)
      (REG_ECTYPE, REG_EESCAPE, REG_ESUBREG, REG_EBRACK, REG_EPAREN)
      (REG_EBRACE, REG_BADBR, REG_ERANGE, REG_ESPACE, REG_BADRPT)
      (REG_EEND, REG_ESIZE, REG_ERPAREN, REG_ERANGEX, REG_ESIZEBR)
      (reg_errcode_t, REGS_UNALLOCATED, REGS_REALLOCATE, REGS_FIXED)
      (RE_NREGS, RE_TRANSLATE, RE_TRANSLATE_P):
      Move here from regex-emacs.h.
      (RE_NREGS): Define unconditionally.
      (boolean): Remove.  All uses replaced by bool.
      (WIDE_CHAR_SUPPORT, regfree, regexec, regcomp, regerror):
      (re_set_syntax, re_syntax_options, WEAK_ALIAS, gettext, gettext_noop):
      Remove.  All uses removed.
      (malloc, realloc, free): Do not redefine.  Adjust all callers
      to use xmalloc, xrealloc, xfree instead.
      (re_error_msgid): Use C99 to avoid need to keep in same order
      as reg_error_t.
      (REGEX_USE_SAFE_ALLOCA): Simplify by using USE_SAFE_ALLOCA.
      (REGEX_ALLOCATE, REGEX_REALLOCATE, REGEX_FREE, REGEX_ALLOCATE_STACK)
      (REGEX_REALLOCATE_STACK, REGEX_FREE_STACK): Remove.
      All callers changed to use the non-REGEX_MALLOC version.
      (REGEX_TALLOC): Remove.  All callers changed to use SAFE_ALLOCA.
      (re_set_syntax): Remove; unused.
      (MATCH_MAY_ALLOCATE): Remove; now always true.  All uses simplified.
      (INIT_FAILURE_ALLOC): Define unconditionally.
      (re_compile_fastmap): Now static.
      (re_compile_pattern): Avoid unnecessary cast.
      * src/regex-emacs.h (EMACS_REGEX_H): Renamed from _REGEX_H to
      avoid possible collision with glibc.
      Don’t include sys/types.h.  All uses of ssize_t changed to ptrdiff_t.
      Don’t worry about C++ or VMS.
      Assume emacs is defined and that _REGEX_RE_COMP and WIDE_CHAR_SUPPORT
      are not.
      Define struct re_registers before including lisp.h.
      (REG_ENOSYS, RE_TRANSLATE_TYPE): Remove; all uses replaced by
      Lisp_Object.
      (regoff_t): Remove.  All uses replaced with ptrdiff_t.
      (re_match, regcomp, regexec, regerror, regfree):
      Remove decl of nonexistent functions.
      (RE_DEBUG, RE_SYNTAX_AWK, RE_SYNTAX_GNU_AWK)
      (RE_SYNTAX_POSIX_AWK, RE_SYNTAX_GREP, RE_SYNTAX_EGREP)
      (RE_SYNTAX_POSIX_EGREP, RE_SYNTAX_ED, RE_SYNTAX_SED)
      (_RE_SYNTAX_POSIX_COMMON, RE_SYNTAX_POSIX_BASIC)
      (RE_SYNTAX_POSIX_MINIMAL_BASIC, RE_SYNTAX_POSIX_EXTENDED)
      (RE_SYNTAX_POSIX_MINIMAL_EXTENDED, REG_EXTENDED, REG_ICASE)
      (REG_NEWLINE, REG_NOSUB, REG_NOTBOL, REG_NOTEOL, regmatch_t):
      Remove; unused.
      * src/search.c (Fset_match_data): Simplify range test now that
      we know it’s ptrdiff_t.
      3a6abe65
    • Paul Eggert's avatar
      Rename src/regex.c to src/regex-emacs.c. · e5652268
      Paul Eggert authored
      This is in preparation for using Gnulib regex for etags,
      to avoid collisions in include directives.
      * src/regex-emacs.c: Rename from src/regex.c.
      * src/regex-emacs.h: Rename from src/regex.h.  All uses changed.
      * test/src/regex-emacs-tests.el: Rename from test/src/regex-tests.el.
      e5652268
  19. 28 Jun, 2018 1 commit
    • Paul Eggert's avatar
      Tune SAFE_FREE · 76eda952
      Paul Eggert authored
      On my platform (Fedora 28 x86-64, AMD Phenom II X4 910e) this sped
      up a SAFE_FREE-using microbenchmark (string-distance "abc" "abc")
      by about 18%, and shrank the Emacs text size by about 0.1%.
      * src/callint.c (Fcall_interactively):
      * src/callproc.c (call_process):
      * src/doc.c (get_doc_string, Fsnarf_documentation):
      * src/editfns.c (Freplace_buffer_contents):
      * src/emacs-module.c (funcall_module):
      * src/eval.c (Flet):
      * src/process.c (Fmake_process):
      * src/term.c (tty_menu_show):
      * src/xdisp.c (safe__call):
      * src/xmenu.c (x_menu_show):
      Use SAFE_FREE_UNBIND_TO.
      * src/data.c (wrong_choice): No need to call SAFE_FREE here.
      * src/lisp.h (USE_SAFE_ALLOCA):
      * src/regex.c (REGEX_USE_SAFE_ALLOCA):
      Do not declare sa_must_free local; no longer needed.
      All uses removed.
      (SAFE_FREE): Rewrite in terms of safe_free.
      (safe_free): New function, optimized to use xfree.
      (SAFE_FREE_UNBIND_TO): New macro.
      (safe_free_unbind_to): New function.
      76eda952
  20. 16 Jun, 2018 1 commit
    • Daniel Colascione's avatar
      Make regex matching reentrant; update syntax during match · 938d252d
      Daniel Colascione authored
      * src/lisp.h (compile_pattern): Remove prototype of
      now-internal function.
      
      * src/regex.c (POS_AS_IN_BUFFER): Consult gl_state instead of
      re_match_object: the latter can change in Lisp.
      (re_match_2_internal): Switch back to UPDATE_SYNTAX_* FROM
      UPDATE_SYNTAX_FAST*, allowing calls into Lisp.
      
      * src/regex.h (re_match_object): Uncomment declaration.
      
      * src/search.c (struct regexp_cache): Add `busy' field.
      (thaw_buffer_relocation): Delete; rely on unbind.
      (compile_pattern_1): Assert pattern isn't busy.
      (shrink_regexp_cache): Don't shrink busy patterns.
      (clear_regexp_cache): Don't nuke busy patterns.
      (unfreeze_pattern, freeze_pattern): New functions.
      (compile_pattern): Return a regexp_cache pointer instead of the
      re_pattern_buffer, allowing callers to use `freeze_pattern' if
      needed.  Do not consider busy patterns as cache hit candidates;
      error if we run out of non-busy cache entries.
      (looking_at_1, fast_looking_at): Snapshot
      Vinhibit_changing_match_data; mark pattern busy while we're
      matching it; unbind.
      (string_match_1, fast_string_match_internal)
      (fast_c_string_match_ignore_case): Adjust for compile_pattern
      return type.
      (search_buffer_re): Regex code from old search_buffer moved here;
      snapshot Vinhibit_changing_match_data; mark pattern busy while
      we're matching it; unbind.
      (search_buffer_non_re): Non-regex code from old search_buffer
      moved here.
      (search_buffer): Split into search_buffer_re,
      search_buffer_non_re.
      (syms_of_search): Staticpro re_match_object, even though we really
      shouldn't have to.
      
      * src/syntax.h (UPDATE_SYNTAX_TABLE_FORWARD_FAST):
      (UPDATE_SYNTAX_TABLE_FAST): Remove.
      
      * src/thread.h (struct thread_state): Remove m_re_match_object,
      which is global again.  (It never needs to be preserved across
      thread switch.)
      938d252d
  21. 01 May, 2018 1 commit
    • Paul Eggert's avatar
      Port --enable-gcc-warnings to GCC 8 · 65ac2778
      Paul Eggert authored
      Backport from master.
      * lib-src/emacsclient.c (fail):
      Do not dereference a null pointer.
      * src/frame.c (delete_frame):
      Add a decl with UNINIT to work around GCC bug 85563.
      * src/menu.h (finish_menu_items):
      Do not use attribute const.
      * src/regex.c (analyze_first): Use FALLTHROUGH, not a comment.
      65ac2778
  22. 28 Apr, 2018 1 commit
    • Paul Eggert's avatar
      Port --enable-gcc-warnings to GCC 8 · 8c3215e7
      Paul Eggert authored
      * configure.ac: Do not use GCC 8’s new -Wcast-align flag.
      * lib-src/ebrowse.c (xmalloc):
      * lib-src/emacsclient.c (xmalloc, xstrdup):
      * lib-src/etags.c (xmalloc):
      * lib-src/make-docfile.c (xmalloc):
      * lib-src/movemail.c (xmalloc):
      * src/dispnew.c (new_glyph_pool):
      * src/regex.c (xmalloc):
      * src/term.c (tty_menu_create):
      * src/tparam.h (tparam):
      Use ATTRIBUTE_MALLOC.  Also see GCC bug 85562.
      * lib-src/emacsclient.c (fail):
      Do not dereference a null pointer.
      * src/frame.c (delete_frame):
      Add a decl with UNINIT to work around GCC bug 85563.
      * src/menu.h (finish_menu_items):
      Do not use attribute const.
      * src/regex.c (analyze_first): Use FALLTHROUGH, not a comment.
      8c3215e7
  23. 16 Feb, 2018 1 commit
  24. 27 Jan, 2018 1 commit
    • Noam Postavsky's avatar
      Raise limit of regexp repetition (Bug#24914) · 559f1606
      Noam Postavsky authored
      * src/regex.h (RE_DUP_MAX): Raise limit to 2^16-1.
      * etc/NEWS: Announce it.
      * doc/lispref/searching.texi (Regexp Backslash): Document it.
      * test/src/regex-tests.el (regex-repeat-limit): Test it.
      
      * src/regex.h (reg_errcode_t): Add REG_ESIZEBR code.
      * src/regex.c (re_error_msgid): Add corresponding entry.
      (GET_INTERVAL_COUNT): Return it instead of the more generic REG_EBADBR
      when encountering a repetition greater than RE_DUP_MAX.
      
      * lisp/isearch.el (isearch-search): Don't convert errors starting with
      "Invalid" into "incomplete".  Such errors are not incomplete, in the
      sense that they cannot be corrected by appending more characters to
      the end of the regexp.  The affected error messages are:
      
      - REG_BADPAT "Invalid regular expression"
        - \\(?X:\\) where X is not a legal group number
        - \\_X where X is not < or >
      
      - REG_ECOLLATE "Invalid collation character"
        - There is no code to throw this.
      
      - REG_ECTYPE "Invalid character class name"
        - [[:foo:] where foo is not a valid class name
      
      - REG_ESUBREG "Invalid back reference"
        - \N where N is referenced before matching group N
      
      - REG_BADBR "Invalid content of \\{\\}"
        - \\{N,M\\} where N < 0, M < N, M or N larger than max
        - \\{NX where X is not a digit or backslash
        - \\{N\\X where X is not a }
      
      - REG_ERANGE "Invalid range end"
        - There is no code to throw this.
      
      - REG_BADRPT "Invalid preceding regular expression"
        - We never throw this.  It would usually indicate a "*" with no
          preceding regexp text, but Emacs allows that to match a literal
          "*".
      559f1606
  25. 01 Jan, 2018 1 commit
  26. 03 Nov, 2017 1 commit
    • Paul Eggert's avatar
      Simplify by assuming !_MSC_VER. · 5b4ff53a
      Paul Eggert authored
      Emacs has not been portable to MSVC for some time (Bug#29040#57).
      * admin/CPP-DEFINES (_MSC_VER): Remove.
      * src/lisp.h (ENUM_BF, DEFUN):
      * src/regex.c (re_char):
      Simplify by assuming _MSC_VER is not defined.
      * src/regex.c (const_re_char): Remove.
      All uses replaced by re_char.
      5b4ff53a
  27. 13 Sep, 2017 1 commit
    • Paul Eggert's avatar
      Prefer HTTPS to FTP and HTTP in documentation · bc511a64
      Paul Eggert authored
      Most of this change is to boilerplate commentary such as license URLs.
      This change was prompted by ftp://ftp.gnu.org's going-away party,
      planned for November.  Change these FTP URLs to https://ftp.gnu.org
      instead.  Make similar changes for URLs to other organizations moving
      away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
      fsf.org when this works, as this will further help defend against
      man-in-the-middle attacks (for this part I omitted the MS-DOS and
      MS-Windows sources and the test tarballs to keep the workload down).
      HTTPS is not fully working to lists.gnu.org so I left those URLs alone
      for now.
      bc511a64
  28. 30 Jul, 2017 1 commit
  29. 06 Jul, 2017 1 commit
    • Paul Eggert's avatar
      Convert hex digits more systematically · d6662694
      Paul Eggert authored
      This makes the code a bit smaller and presumably faster, as
      it substitutes a single lookup for conditional jumps.
      * src/character.c (hexdigit): New constant.
      (syms_of_character) [HEXDIGIT_IS_CONST]: Initialize it.
      * src/character.h (HEXDIGIT_CONST, HEXDIGIT_IS_CONST): New macros.
      (hexdigit): New decl.
      (char_hexdigit): New inline function.
      * src/charset.c: Do not include c-ctype.h.
      * src/charset.c (read_hex):
      * src/editfns.c (styled_format):
      * src/image.c (xbm_scan):
      * src/lread.c (read_escape):
      * src/regex.c (ISXDIGIT) [emacs]:
      Use char_hexdigit insted of doing it by hand.
      d6662694
  30. 16 May, 2017 2 commits
    • Paul Eggert's avatar
      Pacify GCC 7 with --enable-gcc-warnings · c4ac34f2
      Paul Eggert authored
      * src/regex.c (regex_compile): Swap labels, so that the
      FALLTHROUGH immediately precedes the case label.
      c4ac34f2
    • Paul Eggert's avatar
      Merge with gnulib, pacifying GCC 7 · 2e1bebe2
      Paul Eggert authored
      This incorporates:
      2017-05-16 manywarnings: update for GCC 7
      2017-05-15 sys_select: Avoid "was expanded before it was required"
      * configure.ac (nw): Suppress GCC 7’s new -Wduplicated-branches and
      -Wformat-overflow=2 options, due to too many false alarms.
      * doc/misc/texinfo.tex, lib/strftime.c, m4/manywarnings.m4:
      Copy from gnulib.
      * m4/gnulib-comp.m4: Regenerate.
      * src/coding.c (decode_coding_iso_2022):
      Fix bug uncovered by -Wimplicit-fallthrough.
      * src/conf_post.h (FALLTHROUGH): New macro.
      Use it to mark all switch cases that fall through.
      * src/editfns.c (styled_format): Use !, not ~, on bool.
      * src/gtkutil.c (xg_check_special_colors):
      When using sprintf, don’t trust Gtk to output colors in [0, 1] range.
      (xg_update_scrollbar_pos): Avoid use of possibly-uninitialized bool;
      this bug was actually caught by Clang.
      * src/search.c (boyer_moore):
      Tell GCC that CHAR_BASE, if nonzero, must be a non-ASCII character.
      * src/xterm.c (x_draw_glyphless_glyph_string_foreground):
      Tell GCC that glyph->u.glyphless.ch must be a character.
      2e1bebe2