summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-12-14 06:50:43 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-12-14 06:50:43 +0000
commit9d228b13deccfdf23f44e2c465f723a2a7b3bcbd (patch)
tree9a4d769804c389b6b03bbfdf65e8e0a03288c8e8 /re.c
parentc18d3740a925e8752c3b93acea6087fb0e03be53 (diff)
19991214
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/re.c b/re.c
index 9452e42..46ed3ef 100644
--- a/re.c
+++ b/re.c
@@ -508,6 +508,32 @@ rb_reg_prepare_re(reg)
}
int
+rb_reg_adjust_startpos(reg, str, pos, reverse)
+ VALUE reg, str;
+ int pos, reverse;
+{
+ int range;
+
+ if (may_need_recompile)
+ rb_reg_prepare_re(reg);
+
+ if (FL_TEST(reg, KCODE_FIXED))
+ kcode_set_option(reg);
+ else if (reg_kcode != curr_kcode)
+ kcode_reset_option();
+
+ if (reverse) {
+ range = -pos;
+ }
+ else {
+ range = RSTRING(str)->len - pos;
+ }
+ return re_adjust_startpos(RREGEXP(reg)->ptr,
+ RSTRING(str)->ptr, RSTRING(str)->len,
+ pos, range);
+}
+
+int
rb_reg_search(reg, str, pos, reverse)
VALUE reg, str;
int pos, reverse;