summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-14 06:23:46 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-03-14 06:23:46 +0000
commit997b69cb6ac9eb97ea644276f1af886a49c1de03 (patch)
tree1dffc60dc5f5afbec79dc8d0f314c3355f92dab2 /re.c
parent4f0870f74b530cdb2de4306d55e966a924a9149c (diff)
* re.c (rb_reg_match): should clear $~ if operand is nil.
* re.c (rb_reg_match2): ditto. * configure: merge Jonathan Baker's large file support patch [ruby-talk:35316], with read_all patch in [ruby-talk:35470]. * eval.c (rb_f_abort): optional message argument that be printed on termination. [new] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/re.c b/re.c
index 5e73ddbd8b..99759c93d9 100644
--- a/re.c
+++ b/re.c
@@ -637,7 +637,7 @@ rb_reg_search(re, str, pos, reverse)
if (result == -2) {
rb_reg_raise(RREGEXP(re)->str, RREGEXP(re)->len,
- "Stack overflow in regexp matcher", re);
+ "Stack overflow in regexp matcher", re);
}
if (result < 0) {
@@ -1001,7 +1001,10 @@ rb_reg_match(re, str)
{
int start;
- if (NIL_P(str)) return Qnil;
+ if (NIL_P(str)) {
+ rb_backref_set(Qnil);
+ return Qnil;
+ }
StringValue(str);
start = rb_reg_search(re, str, 0, 0);
if (start < 0) {
@@ -1017,8 +1020,10 @@ rb_reg_match2(re)
int start;
VALUE line = rb_lastline_get();
- if (TYPE(line) != T_STRING)
+ if (TYPE(line) != T_STRING) {
+ rb_backref_set(Qnil);
return Qnil;
+ }
start = rb_reg_search(re, line, 0, 0);
if (start < 0) {