summaryrefslogtreecommitdiff
path: root/src/regex-emacs.c
Commit message (Collapse)AuthorAge
* Update copyright year to 2021Paul Eggert2021-01-01
| | | | Run "TZ=UTC0 admin/update-copyright".
* Fix [:upper:] and [:lower:] for Unicode characters (bug#11309)Mattias Engdegård2020-12-09
| | | | | | | | * src/regex-emacs.c (execute_charset): Add canon_table argument to allow expression of a correct predicate for [:upper:] and [:lower:]. (mutually_exclusive_p, re_match_2_internal): Pass extra argument. * test/src/regex-emacs-tests.el (regexp-case-fold, regexp-eszett): New tests. Parts of regexp-eszett still fail and are commented out.
* regex-emacs: copy less when reallocatingPaul Eggert2020-08-26
| | | | | * src/regex-emacs.c (GROW_FAIL_STACK): Copy just the occupied stack slots, as the rest are garbage.
* regex-emacs: fix leak on memory allocation failurePaul Eggert2020-08-26
| | | | | | * src/regex-emacs.c (ENSURE_FAIL_STACK): If the failure stack cannot be grown, free locally-allocated storage before returning.
* regex-emacs: subscript-check register numbersPaul Eggert2020-08-26
| | | | | * src/regex-emacs.c (PUSH_FAILURE_REG, POP_FAILURE_REG_OR_COUNT) (re_match_2_internal): Add some easserts for subscript checking.
* regex-emacs: omit regstart tests and regend setPaul Eggert2020-08-26
| | | | | | | | * src/regex-emacs.c (PUSH_FAILURE_REG, POP_FAILURE_REG_OR_COUNT) (re_match_2_internal): Add some assertions that regstart is set whenever regend is. (re_match_2_internal): Omit two unnecessary REG_UNSET (regstart ...)s and one unnecessary assignment to regend.
* regex-emacs omit allocation of 3 slotsPaul Eggert2020-08-26
| | | | | | * src/regex-emacs.c (re_match_2_internal): Avoid unnecessary allocation of REGEND[0], BEST_REGSTART[0], BEST_REGEND[0].
* regex-emacs omit POS runtime checkPaul Eggert2020-08-26
| | | | | * src/regex-emacs.c (re_match_2_internal): Replace unnecessary runtime check of POS with some eassumes.
* Simplify use of __lsan_ignore_objectPaul Eggert2020-08-03
| | | | | | | | | * configure.ac: Use AC_CHECK_FUNCS_ONCE for __lsan_ignore_object. * src/buffer.c, src/data.c, src/emacs-module.c, src/regex-emacs.c: * src/search.c: Use __lsan_ignore_object unconditionally, and don’t include sanitizer/lsan_interface.h. * src/lisp.h (__lsan_ignore_object): Provide a dummy in the typical case where leak sanitization is not available.
* Use a more precise check for '__lsan_ignore_object'Philipp Stephani2020-08-01
| | | | | | | | | | * configure.ac: Add check for __lsan_ignore_object. * src/buffer.c (enlarge_buffer_text): * src/data.c (make_blv): * src/emacs-module.c (Fmodule_load, initialize_environment): * src/regex-emacs.c (regex_compile): * src/search.c (newline_cache_on_off): Use new configuration macro.
* Suppress leak sanitizer in a few more placesPhilipp Stephani2020-08-01
| | | | | * src/regex-emacs.c (regex_compile): src/search.c (newline_cache_on_off): Suppress leak sanitizer.
* Merge from origin/emacs-27Glenn Morris2020-04-20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 05089a4d65 (origin/emacs-27) Tweak wording re constant variables a1040861f1 Tweak setcar-related wording 751510f865 * lisp/image-mode.el: Add prefix key 's' and reduce depend... 9261a219ec * doc/emacs/windows.texi (Window Convenience): Decribe mor... e1d42da0d6 Fix mutability glitches reported by Drew Adams 5805df74f5 Improve mutability doc dca35b31d0 Improve mutability documentation 81e7d7f111 Document that quoting yields constants 5734339f40 * doc/lispref/keymaps.texi (Extended Menu Items, Easy Menu... 14a570afae Remove #' and function quoting from lambda forms in manual d5ec18c66b * src/regex-emacs.c (re_match_2_internal): Rework comment ... 4df8a61117 Add new node "Image Mode" to Emacs Manual. d7d5ee6c57 ; Fix a typo in cmdargs.texi (bug#40701) 5e9db48fbe * doc/lispref/display.texi (Customizing Bitmaps): Fix typo. eebfb72c90 Document constant vs mutable objects better 6c187ed6b0 Improve documentation of 'sort-lines' 52288f4b66 Mention 'spam-stat-process-directory-age' in the documenta... 067b070598 ; Fix some typos and doc issues (bug#40695) # Conflicts: # etc/NEWS
| * * src/regex-emacs.c (re_match_2_internal): Rework comment in last changeStefan Monnier2020-04-18
| | | | | | | | | | | | Explain why we don't need to worry about Lisp modifying the buffer. * src/syntax.c (parse_sexp_propertize): Fix name in error message.
* | Merge from origin/emacs-27Glenn Morris2020-04-18
|\| | | | | | | | | | | | | | | | | | | | | | | f3b62b6c62 (origin/emacs-27) Avoid crashes in regex-emacs.c due to GC 175c61c18b Fix "C-u M-!" when 'shell-command-dont-erase-buffer' is no... 6b297519b5 Fix cl-most-positive-float doc typo c36c5a3ded ; lisp/ldefs-boot.el: Update. 3876a60569 Fix a typo in calculator.el 9e832ba91b * lisp/erc/erc.el: Add URL to the new ERC page on the Emac... # Conflicts: # etc/NEWS
| * Avoid crashes in regex-emacs.c due to GCEli Zaretskii2020-04-18
| | | | | | | | | | * src/regex-emacs.c (re_match_2_internal): Prevent GC from invalidating C pointers to buffer text. (Bug#40661)
* | Prefer more inline functions in character.hPaul Eggert2020-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Don't generate useless range table entries for ASCII charsMattias Engdegård2020-03-17
| | | | | | | | | | | | | | | | | | 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.
* | Revert "Signal an error for the regexp "[:alnum:]""Mattias Engdegård2020-02-27
| | | | | | | | This reverts commit 8d5e8cddab732ac90e9ae930c63f7830f9dab24f.
* | Revert "Don't complain about the regexp "[:-:]""Mattias Engdegård2020-02-27
| | | | | | | | This reverts commit 3766bf728a43933083f4525970bcf9fdace3838d.
* | Don't complain about the regexp "[:-:]"Mattias Engdegård2020-02-26
| | | | | | | | | | | | | | Suggested by Clément Pit-Claudel. * src/regex-emacs.c (regex_compile): * test/src/regex-emacs-tests.el (regexp-invalid): Tolerate ranges.
* | Signal an error for the regexp "[:alnum:]"Mattias Engdegård2020-02-26
|/ | | | | | | | | | Omitting the extra brackets is a common mistake; see discussion at https://lists.gnu.org/archive/html/emacs-devel/2020-02/msg00215.html * src/regex-emacs.c (reg_errcode_t, re_error_msgid): Add REG_ECLASSBR. (regex_compile): Check for the mistake. * test/src/regex-emacs-tests.el (regexp-invalid): Test. * etc/NEWS: Announce.
* Correct "different than" to "different from" where appropriateAlan Mackenzie2020-02-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | (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".
* Update copyright year to 2020Paul Eggert2020-01-01
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Use fewer locks when accessing stdioPaul Eggert2019-07-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Fix regex-emacs debug format glitchesPaul Eggert2019-07-01
| | | | | | | | | | 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.
* Correct regexp matching of raw bytesMattias Engdegård2019-06-28
| | | | | | | | | | | | | | | | 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.
* More readable regexp debug outputMattias Engdegård2019-06-28
| | | | | | | * 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.
* Consistently use stderr for debug output in regexp codeMattias Engdegård2019-06-28
| | | | | * src/regex-emacs.c (DEBUG_PRINT, print_fastmap, print_compiled_pattern) (print_double_string, regex_compile): Print to stderr instead of stdout.
* Avoid backslash-newline-newline in source codePaul Eggert2019-05-22
| | | | | | | | | | | | | | | * 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.
* Tweak re_registers allocationPaul Eggert2019-03-27
| | | | | | | * 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.
* Fix some integer issues in regex-emacsPaul Eggert2019-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * src/regex-emacs.c (regex_compile): Fix comments.Paul Eggert2019-03-25
|
* Maintain interval ->position fields correctly in update_intervalAlan Mackenzie2019-03-01
| | | | | | | | | | | | | | | | | | | | | | 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.
* Merge from origin/emacs-26Paul Eggert2018-12-31
| | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
* Assume ‘emacs’ is defined in Emacs-only codePaul Eggert2018-12-17
| | | | | | | * 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.
* Spruce up some regex-emacs commentsPaul Eggert2018-08-05
| | | | * src/regex-emacs.c, src/regex-emacs.h: Update comments.
* Remove always-0 struct re_pattern_buffer membersPaul Eggert2018-08-05
| | | | | | * 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.
* Simplify regex-emacs by assuming Emacs syntaxPaul Eggert2018-08-05
| | | | | | | | | | | | | | | | | * 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.
* Simplify regex-emacs code by assuming EmacsPaul Eggert2018-08-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Rename src/regex.c to src/regex-emacs.c.Paul Eggert2018-08-05
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.