summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-30 06:04:37 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-30 06:04:37 +0000
commit915e23730ed4a603db56170a45d52db167f0f0db (patch)
treef88acf89af9e862592e8abd35f798ad8378e496b /string.c
parent1061c0f7f3c39d725c29371a26fa12bc9cb1a22e (diff)
* string.c (rb_str_sub_bang): calling rb_str_modify() should be just
before actually modifying the string. fixed: [ruby-dev:30211] (originally reported by zunda) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 3261db6..08c958d 100644
--- a/string.c
+++ b/string.c
@@ -1966,7 +1966,6 @@ rb_str_sub_bang(argc, argv, str)
pat = get_pat(argv[0], 1);
if (rb_reg_search(pat, str, 0, 0) >= 0) {
- rb_str_modify(str);
match = rb_backref_get();
regs = RMATCH(match)->regs;
@@ -1982,6 +1981,7 @@ rb_str_sub_bang(argc, argv, str)
else {
repl = rb_reg_regsub(repl, str, regs);
}
+ rb_str_modify(str);
if (OBJ_TAINTED(repl)) tainted = 1;
plen = END(0) - BEG(0);
if (RSTRING(repl)->len > plen) {