aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1998-04-12 06:57:47 +0000
committerKarl Heuer1998-04-12 06:57:47 +0000
commitcc9b4df2b412a5638f4be7ebd77249a1bf46fce9 (patch)
tree641e79d761cabd039fa74341cb7e9b73a66827f6
parentf79b4b7ee28adece8322e29a5548c9904ebbe316 (diff)
downloademacs-cc9b4df2b412a5638f4be7ebd77249a1bf46fce9.tar.gz
emacs-cc9b4df2b412a5638f4be7ebd77249a1bf46fce9.zip
(re_match_2, re_search_2): Convert position to a charpos,
before calling SETUP_SYNTAX_TABLE_FOR_OBJECT.
-rw-r--r--src/regex.c20
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)
3738 anchored_start = 1; 3738 anchored_start = 1;
3739 3739
3740#ifdef emacs 3740#ifdef emacs
3741 SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, 3741 gl_state.object = re_match_object;
3742 POS_AS_IN_BUFFER (startpos > 0 3742 {
3743 ? startpos - 1 : startpos), 3743 int charpos
3744 1); 3744 = SYNTAX_TABLE_BYTE_TO_CHAR (startpos > 0 ? startpos : startpos + 1);
3745
3746 SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1);
3747 }
3745#endif 3748#endif
3746 3749
3747 /* Loop through the string, looking for a place to start matching. */ 3750 /* 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)
4051 int result; 4054 int result;
4052 4055
4053#ifdef emacs 4056#ifdef emacs
4054 SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, 4057 int charpos;
4055 POS_AS_IN_BUFFER (pos > 0 ? pos - 1 : pos), 4058 gl_state.object = re_match_object;
4056 1); 4059 charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (pos));
4060 SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1);
4057#endif 4061#endif
4058 4062
4059 result = re_match_2_internal (bufp, string1, size1, string2, size2, 4063 result = re_match_2_internal (bufp, string1, size1, string2, size2,
4060 pos, regs, stop); 4064 pos, regs, stop);
4061 alloca (0); 4065 alloca (0);
4062 return result; 4066 return result;
4063} 4067}