summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-13 09:51:02 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-13 09:51:02 +0000
commit1b47fa1097c709be518a5071a7ec0e5271d45a00 (patch)
tree62f7220ccb1211efc9e1bc9b69c28448173c03bf /re.c
parent1c940e6cdd3e59430d57a42a9d5989bc5ad85270 (diff)
2000-06-13
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/re.c b/re.c
index 67dbc87b5c..16930cdf2b 100644
--- a/re.c
+++ b/re.c
@@ -477,14 +477,20 @@ rb_reg_prepare_re(reg)
{
int need_recompile = 0;
- /* case-flag not set for the object */
- if (!FL_TEST(reg, REG_IGNORECASE)) {
- int state = FL_TEST(reg, REG_CASESTATE);
+ int state;
- if ((ruby_ignorecase || state) && !(ruby_ignorecase && state)) {
- RBASIC(reg)->flags ^= REG_CASESTATE;
- need_recompile = 1;
- }
+ rb_reg_check(re);
+ state = FL_TEST(re, REG_CASESTATE);
+ /* ignorecase status */
+ if (ruby_ignorecase && !state) {
+ FL_SET(re, REG_CASESTATE);
+ RREGEXP(re)->ptr->options |= RE_OPTION_IGNORECASE;
+ need_recompile = 1;
+ }
+ if (!ruby_ignorecase && state) {
+ FL_UNSET(re, REG_CASESTATE);
+ RREGEXP(re)->ptr->options &= ~RE_OPTION_IGNORECASE;
+ need_recompile = 1;
}
if (!FL_TEST(reg, KCODE_FIXED) &&
@@ -558,7 +564,7 @@ rb_reg_search(reg, str, pos, reverse)
if (result == -2) {
rb_reg_raise(RREGEXP(reg)->str, RREGEXP(reg)->len,
- "Stack overfow in regexp matcher", reg);
+ "Stack overflow in regexp matcher", reg);
}
if (result < 0) {
matchcache = match;