summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-05 09:27:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-05 09:27:21 +0000
commit808aa5f3183a0ebb20e61c80260fa111b337bec9 (patch)
treed10d7abe63a6dde453a96ee99953380b89a9e854 /string.c
parent5e12815fb1cbc102258bfe4904acf7e75f4c7e54 (diff)
* lib/shell/command-processor.rb (Shell::CommandProcessor::rmdir):
simple typo. * string.c (str_new4): ptr may refer null_str. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/string.c b/string.c
index ae157f474e..248813e233 100644
--- a/string.c
+++ b/string.c
@@ -144,8 +144,14 @@ str_new4(klass, str)
RSTRING(str2)->len = RSTRING(str)->len;
RSTRING(str2)->ptr = RSTRING(str)->ptr;
- RSTRING(str)->aux.shared = str2;
- FL_SET(str, ELTS_SHARED);
+ if (FL_TEST(str, ELTS_SHARED) && !RSTRING(str)->aux.shared) {
+ /* ptr should be null_str */
+ FL_SET(str2, ELTS_SHARED);
+ }
+ else {
+ FL_SET(str, ELTS_SHARED);
+ RSTRING(str)->aux.shared = str2;
+ }
OBJ_INFECT(str2, str);
return str2;