summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-08 10:56:14 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-08 10:56:14 +0000
commit66b90d0f5c38ad4d8585cfc9e4d2ca923cc08539 (patch)
tree4fa1b092f971cf48a10af796fcb443a82c89ca77 /variable.c
parent391fc1e8d9e1625c06c50e9f5b66d624e183200a (diff)
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
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/variable.c b/variable.c
index 5d4a4ad2cc..03efd1de15 100644
--- a/variable.c
+++ b/variable.c
@@ -212,6 +212,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)
{
VALUE str;