diff options
| author | Karl Heuer <kwzh@gnu.org> | 1998-04-12 06:57:47 +0000 |
|---|---|---|
| committer | Karl Heuer <kwzh@gnu.org> | 1998-04-12 06:57:47 +0000 |
| commit | cc9b4df2b412a5638f4be7ebd77249a1bf46fce9 (patch) | |
| tree | 641e79d761cabd039fa74341cb7e9b73a66827f6 /src/regex.c | |
| parent | f79b4b7ee28adece8322e29a5548c9904ebbe316 (diff) | |
| download | emacs-cc9b4df2b412a5638f4be7ebd77249a1bf46fce9.tar.gz | |
(re_match_2, re_search_2): Convert position to a charpos,
before calling SETUP_SYNTAX_TABLE_FOR_OBJECT.
Diffstat (limited to 'src/regex.c')
| -rw-r--r-- | src/regex.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/regex.c b/src/regex.c index 29928e9dfc2..940c95f448a 100644 --- a/src/regex.c +++ b/src/regex.c @@ -3738,10 +3738,13 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) anchored_start = 1; #ifdef emacs - SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, - POS_AS_IN_BUFFER (startpos > 0 - ? startpos - 1 : startpos), - 1); + gl_state.object = re_match_object; + { + int charpos + = SYNTAX_TABLE_BYTE_TO_CHAR (startpos > 0 ? startpos : startpos + 1); + + SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); + } #endif /* Loop through the string, looking for a place to start matching. */ @@ -4051,13 +4054,14 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) int result; #ifdef emacs - SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, - POS_AS_IN_BUFFER (pos > 0 ? pos - 1 : pos), - 1); + int charpos; + gl_state.object = re_match_object; + charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (pos)); + SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); #endif result = re_match_2_internal (bufp, string1, size1, string2, size2, - pos, regs, stop); + pos, regs, stop); alloca (0); return result; } |
