diff options
| author | Stefan Monnier | 2023-04-12 16:32:39 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2023-04-12 16:32:39 -0400 |
| commit | 861cf3a5c9d2081d811dcfc2c5ce5357f3dc44d4 (patch) | |
| tree | 9431d7ef315d5a4081cb3fc65487c3fdd35354d7 /src/syntax.c | |
| parent | c2c3114961802b4c52b4cde0271e460fb08698cf (diff) | |
| download | emacs-861cf3a5c9d2081d811dcfc2c5ce5357f3dc44d4.tar.gz emacs-861cf3a5c9d2081d811dcfc2c5ce5357f3dc44d4.zip | |
(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) | |||
| 268 | FROMBYTE is an regexp-byteoffset. */ | 268 | FROMBYTE is an regexp-byteoffset. */ |
| 269 | 269 | ||
| 270 | void | 270 | void |
| 271 | SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, | 271 | RE_SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, |
| 272 | ptrdiff_t frombyte, ptrdiff_t count) | 272 | ptrdiff_t frombyte) |
| 273 | { | 273 | { |
| 274 | SETUP_BUFFER_SYNTAX_TABLE (); | 274 | SETUP_BUFFER_SYNTAX_TABLE (); |
| 275 | gl_state.object = object; | 275 | gl_state.object = object; |
| 276 | ptrdiff_t from = SYNTAX_TABLE_BYTE_TO_CHAR (frombyte); | ||
| 277 | if (BUFFERP (gl_state.object)) | 276 | if (BUFFERP (gl_state.object)) |
| 278 | { | 277 | { |
| 279 | struct buffer *buf = XBUFFER (gl_state.object); | 278 | struct buffer *buf = XBUFFER (gl_state.object); |
| @@ -296,8 +295,8 @@ SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object, | |||
| 296 | gl_state.e_property = 1 + SCHARS (gl_state.object); | 295 | gl_state.e_property = 1 + SCHARS (gl_state.object); |
| 297 | } | 296 | } |
| 298 | if (parse_sexp_lookup_properties) | 297 | if (parse_sexp_lookup_properties) |
| 299 | update_syntax_table (from - (count <= 0), | 298 | update_syntax_table (RE_SYNTAX_TABLE_BYTE_TO_CHAR (frombyte), |
| 300 | count, 1, gl_state.object); | 299 | 1, 1, gl_state.object); |
| 301 | } | 300 | } |
| 302 | 301 | ||
| 303 | /* Update gl_state to an appropriate interval which contains CHARPOS. The | 302 | /* Update gl_state to an appropriate interval which contains CHARPOS. The |