diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2023-04-12 16:32:39 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2023-04-12 16:32:39 -0400 |
commit | 861cf3a5c9d2081d811dcfc2c5ce5357f3dc44d4 (patch) | |
tree | 9431d7ef315d5a4081cb3fc65487c3fdd35354d7 /src/syntax.c | |
parent | c2c3114961802b4c52b4cde0271e460fb08698cf (diff) | |
download | emacs-861cf3a5c9d2081d811dcfc2c5ce5357f3dc44d4.tar.gz |
(RE_SETUP_SYNTAX_TABLE_FOR_OBJECT): Simplify
It turns out all calls to this function pass the same value
for the `count` argument, and they're all in `regexp.c`.
* src/syntax.c (RE_SETUP_SYNTAX_TABLE_FOR_OBJECT):
Rename from `SETUP_SYNTAX_TABLE_FOR_OBJECT`. Remove `count` argument.
Move call to `RE_SYNTAX_TABLE_BYTE_TO_CHAR` to where its result is
actually used.
* src/regex-emacs.c (re_search_2, re_match_2): Adjust accordingly.
* src/syntax.h (RE_SYNTAX_TABLE_BYTE_TO_CHAR): Rename from
`SYNTAX_TABLE_BYTE_TO_CHAR` to clarify that it takes a byteoffset as
used in the regexp engine and not a "bytepos". Adjust all callers.
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/syntax.c b/src/syntax.c index c1caaa8a739..e9e04e2d638 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -268,12 +268,11 @@ SETUP_SYNTAX_TABLE (ptrdiff_t from, ptrdiff_t count) FROMBYTE is an regexp-byteoffset. */ void -SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, - ptrdiff_t frombyte, ptrdiff_t count) +RE_SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, + ptrdiff_t frombyte) { SETUP_BUFFER_SYNTAX_TABLE (); gl_state.object = object; - ptrdiff_t from = SYNTAX_TABLE_BYTE_TO_CHAR (frombyte); if (BUFFERP (gl_state.object)) { struct buffer *buf = XBUFFER (gl_state.object); @@ -296,8 +295,8 @@ SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, gl_state.e_property = 1 + SCHARS (gl_state.object); } if (parse_sexp_lookup_properties) - update_syntax_table (from - (count <= 0), - count, 1, gl_state.object); + update_syntax_table (RE_SYNTAX_TABLE_BYTE_TO_CHAR (frombyte), + 1, 1, gl_state.object); } /* Update gl_state to an appropriate interval which contains CHARPOS. The |