diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-20 15:18:35 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-20 15:18:35 +0000 |
commit | 688c69b1f7ed0949673dc8932de2e9fb54a5a9e7 (patch) | |
tree | 2b03fb774f420e705cd05aaf2f1e7295bc5ce30d /string.c | |
parent | fc4a280c75e23e71fa1e84a69c8ce3123e1533bb (diff) | |
download | ruby-688c69b1f7ed0949673dc8932de2e9fb54a5a9e7.tar.gz |
* string.c (rb_str_splice): should place index wrapping after
possible modification. [ruby-dev:24940]
* eval.c (error_print): nicer traceback at interrupt.
[ruby-core:03774]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1628,6 +1628,10 @@ rb_str_splice(str, beg, len, val) VALUE val; { if (len < 0) rb_raise(rb_eIndexError, "negative length %ld", len); + + StringValue(val); + rb_str_modify(str); + if (RSTRING(str)->len < beg) { out_of_range: rb_raise(rb_eIndexError, "index %ld out of string", beg); @@ -1642,8 +1646,6 @@ rb_str_splice(str, beg, len, val) len = RSTRING(str)->len - beg; } - StringValue(val); - rb_str_modify(str); if (len < RSTRING(val)->len) { /* expand string */ RESIZE_CAPA(str, RSTRING(str)->len + RSTRING(val)->len - len + 1); |