diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-19 17:02:29 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-19 17:02:29 +0000 |
commit | 77629d2cbe4931e3033ae73cef2e9adf6c1c0373 (patch) | |
tree | 9b75e0c5b7cffd99cebf28cb557f458b5bbfc974 /re.c | |
parent | a927483326e54e6a4e9387009af0b57f38636497 (diff) | |
download | ruby-77629d2cbe4931e3033ae73cef2e9adf6c1c0373.tar.gz |
* string.c (rb_str_rindex_m): too much adjustment.
* re.c (reg_match_pos): pos adjustment should be based on
characters.
* test/ruby/test_m17n.rb (TestM17N::test_str_insert): test updated
to check negative offset behavior.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -2146,7 +2146,8 @@ reg_match_pos(VALUE re, VALUE *strp, long pos) *strp = str = reg_operand(str, Qtrue); if (pos != 0) { if (pos < 0) { - pos += RSTRING_LEN(str); + VALUE l = rb_str_length(str); + pos += NUM2INT(l); if (pos < 0) { return pos; } |