diff options
| author | Daniel Colascione | 2018-06-16 13:46:10 -0700 |
|---|---|---|
| committer | Daniel Colascione | 2018-06-16 13:46:38 -0700 |
| commit | 938d252d1c6c5e2027aa250c649deb024154f936 (patch) | |
| tree | c0ee02c8cb40d0b7fc9bb0fa55ac8569491197c9 /src/thread.h | |
| parent | 1502b377d35d6db623301829549ebcab9a2777e6 (diff) | |
| download | emacs-938d252d1c6c5e2027aa250c649deb024154f936.tar.gz emacs-938d252d1c6c5e2027aa250c649deb024154f936.zip | |
Make regex matching reentrant; update syntax during match
* 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.)
Diffstat (limited to 'src/thread.h')
| -rw-r--r-- | src/thread.h | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/src/thread.h b/src/thread.h index 2c8914e1b28..c10e5ecb758 100644 --- a/src/thread.h +++ b/src/thread.h | |||
| @@ -137,15 +137,6 @@ struct thread_state | |||
| 137 | struct re_registers m_saved_search_regs; | 137 | struct re_registers m_saved_search_regs; |
| 138 | #define saved_search_regs (current_thread->m_saved_search_regs) | 138 | #define saved_search_regs (current_thread->m_saved_search_regs) |
| 139 | 139 | ||
| 140 | /* This is the string or buffer in which we | ||
| 141 | are matching. It is used for looking up syntax properties. | ||
| 142 | |||
| 143 | If the value is a Lisp string object, we are matching text in that | ||
| 144 | string; if it's nil, we are matching text in the current buffer; if | ||
| 145 | it's t, we are matching text in a C string. */ | ||
| 146 | Lisp_Object m_re_match_object; | ||
| 147 | #define re_match_object (current_thread->m_re_match_object) | ||
| 148 | |||
| 149 | /* This member is different from waiting_for_input. | 140 | /* This member is different from waiting_for_input. |
| 150 | It is used to communicate to a lisp process-filter/sentinel (via the | 141 | It is used to communicate to a lisp process-filter/sentinel (via the |
| 151 | function Fwaiting_for_user_input_p) whether Emacs was waiting | 142 | function Fwaiting_for_user_input_p) whether Emacs was waiting |