diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-01-29 05:10:42 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-01-29 05:10:42 +0000 |
commit | 2f0faf671dcf8eadebdd0e35a567ddb8bd95bcaa (patch) | |
tree | 8546241dd9e946b44ace45e8eef03cf479090ed1 /string.c | |
parent | 161e3313d20eb285c8cfc3288e92a6d2e533cf44 (diff) | |
download | ruby-2f0faf671dcf8eadebdd0e35a567ddb8bd95bcaa.tar.gz |
* string.c (str_independent): should not clear str->orig here.
it's too early.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -6,7 +6,7 @@ $Date$ created at: Mon Aug 9 17:12:58 JST 1993 - Copyright (C) 1993-2000 Yukihiro Matsumoto + Copyright (C) 1993-2001 Yukihiro Matsumoto Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Information-technology Promotion Agency, Japan @@ -377,7 +377,6 @@ str_independent(str) rb_raise(rb_eSecurityError, "Insecure: can't modify string"); if (!RSTRING(str)->orig || FL_TEST(str, STR_NO_ORIG)) return 1; if (TYPE(RSTRING(str)->orig) != T_STRING) rb_bug("non string str->orig"); - RSTRING(str)->orig = 0; return 0; } @@ -394,6 +393,7 @@ rb_str_modify(str) } ptr[RSTRING(str)->len] = 0; RSTRING(str)->ptr = ptr; + RSTRING(str)->orig = 0; } VALUE @@ -1294,11 +1294,11 @@ str_gsub(argc, argv, str, bang) OBJSETUP(dup, rb_cString, T_STRING); OBJ_INFECT(dup, str); str = (VALUE)dup; - dup->orig = 0; } RSTRING(str)->ptr = buf; RSTRING(str)->len = len = bp - buf; RSTRING(str)->ptr[len] = '\0'; + RSTRING(str)->orig = 0; if (tainted) OBJ_TAINT(str); return str; |