From 66b90d0f5c38ad4d8585cfc9e4d2ca923cc08539 Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 8 Aug 2009 10:56:14 +0000 Subject: merges r24321 from trunk into ruby_1_9_1. -- * insns.def (defineclass): preserve encoding of class/module names. [ruby-core:24600] * variable.c (rb_set_class_path_string): set class path with a string value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- variable.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'variable.c') diff --git a/variable.c b/variable.c index 5d4a4ad2cc..03efd1de15 100644 --- a/variable.c +++ b/variable.c @@ -211,6 +211,23 @@ rb_class_path(VALUE klass) } } +void +rb_set_class_path_string(VALUE klass, VALUE under, VALUE name) +{ + VALUE str; + + if (under == rb_cObject) { + str = rb_str_new_frozen(name); + } + else { + str = rb_str_dup(rb_class_path(under)); + rb_str_cat2(str, "::"); + rb_str_append(str, name); + OBJ_FREEZE(str); + } + rb_ivar_set(klass, classpath, str); +} + void rb_set_class_path(VALUE klass, VALUE under, const char *name) { -- cgit v1.2.3