summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-06 11:43:40 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-06 11:43:40 +0000
commit05d4bbbbda3896b206006a8c2d7cd509a94ba9bd (patch)
treec18f21579897ffbb259c1b66c21899b51aa0e4c6 /string.c
parent0f0658d08f3661ef9cc5fc7ee5ce952db0c657cd (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) * patchlevel 18. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@11646 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 4651960..58fa036 100644
--- a/string.c
+++ b/string.c
@@ -1963,7 +1963,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;
@@ -1979,6 +1978,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) {