summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-05 15:31:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-05 15:31:42 +0000
commit79cdf2ffa201b3b9f1108d77231a7adae2c4e3bb (patch)
treecf4f3b7def41d8f798af09d200dd52c180df9908 /struct.c
parentfff981ee6de1c91392105aeef60bd17f2b88af70 (diff)
* struct.c (make_struct): preserve encoding of struct name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/struct.c b/struct.c
index 1c7ec1a6b0..a8857ffe92 100644
--- a/struct.c
+++ b/struct.c
@@ -181,14 +181,12 @@ make_struct(VALUE name, VALUE members, VALUE klass)
rb_class_inherited(klass, nstr);
}
else {
- char *cname = StringValuePtr(name);
-
- id = rb_intern(cname);
+ id = SYM2ID(rb_str_intern(name));
if (!rb_is_const_id(id)) {
- rb_name_error(id, "identifier %s needs to be constant", cname);
+ rb_name_error(id, "identifier %s needs to be constant", StringValuePtr(name));
}
if (rb_const_defined_at(klass, id)) {
- rb_warn("redefining constant Struct::%s", cname);
+ rb_warn("redefining constant Struct::%s", StringValuePtr(name));
rb_mod_remove_const(klass, ID2SYM(id));
}
nstr = rb_define_class_under(klass, rb_id2name(id), klass);