diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-14 06:23:46 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-14 06:23:46 +0000 |
commit | 5e853e44c2a63eb82f3928d3b53e75fcde796030 (patch) | |
tree | 1dffc60dc5f5afbec79dc8d0f314c3355f92dab2 /re.c | |
parent | 4f32698827de4d939e811747caf0cc769badbc23 (diff) | |
download | ruby-5e853e44c2a63eb82f3928d3b53e75fcde796030.tar.gz ruby-5e853e44c2a63eb82f3928d3b53e75fcde796030.tar.xz ruby-5e853e44c2a63eb82f3928d3b53e75fcde796030.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@2200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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) { |