From 828cff4f2ce585946749d35f9f45976c7e9dc694 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 5 Mar 2008 15:31:42 +0000 Subject: * struct.c (make_struct): preserve encoding of struct name. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- struct.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'struct.c') diff --git a/struct.c b/struct.c index 1c7ec1a6b..a8857ffe9 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); -- cgit