summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-08 07:55:51 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-08 07:55:51 +0000
commit82f7f29c59bf97dcaf77d06269e03a936fa7a2cb (patch)
tree47ea4bc316d46ceddd5f855827e17c943f150a48
parent3d1b573946ee26775da3268ba585b2276c659342 (diff)
* string.c (str_alloc): should allocate a String object, even when
asked to allocate a Symbol object. [ruby-dev:29529] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--string.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a73b51812b4..5851770aee7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Sep 8 16:53:30 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (str_alloc): should allocate a String object, even when
+ asked to allocate a Symbol object. [ruby-dev:29529]
+
Fri Sep 8 16:36:27 2006 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/extmk.rb (extmake): follow Array#to_s.
diff --git a/string.c b/string.c
index 3935eb426e1..59b81b44e66 100644
--- a/string.c
+++ b/string.c
@@ -119,6 +119,9 @@ str_alloc(VALUE klass)
NEWOBJ(str, struct RString);
OBJSETUP(str, klass, T_STRING);
+ if (klass == rb_cSymbol) {
+ RBASIC(str)->klass = rb_cString;
+ }
str->as.heap.ptr = 0;
str->as.heap.len = 0;
str->as.heap.aux.capa = 0;
@@ -135,7 +138,6 @@ str_new(VALUE klass, const char *ptr, long len)
rb_raise(rb_eArgError, "negative string size (or size too big)");
}
- if (klass == rb_cSymbol) klass = rb_cString;
str = str_alloc(klass);
if (len > RSTRING_EMBED_LEN_MAX) {
RSTRING(str)->as.heap.aux.capa = len;