summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 08:10:23 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 08:10:23 +0000
commitf7f7f93a03f013fb957a0e3e99237f16b5bc1fef (patch)
treebf659f16ad0a53f078185e0b19d388f3b4ee96c7 /dir.c
parent7e2e3dc85d8c02672bc7486630424e7df95ef28b (diff)
merge revision(s) 34795:
* dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path. [Bug #6072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index c530387df7..695ccc743e 100644
--- a/dir.c
+++ b/dir.c
@@ -486,8 +486,12 @@ dir_inspect(VALUE dir)
TypedData_Get_Struct(dir, struct dir_data, &dir_data_type, dirp);
if (!NIL_P(dirp->path)) {
- const char *c = rb_obj_classname(dir);
- return rb_sprintf("#<%s:%s>", c, RSTRING_PTR(dirp->path));
+ VALUE str = rb_str_new_cstr("#<");
+ rb_str_append(str, rb_class_name(CLASS_OF(dir)));
+ rb_str_cat2(str, ":");
+ rb_str_append(str, dirp->path);
+ rb_str_cat2(str, ">");
+ return str;
}
return rb_funcall(dir, rb_intern("to_s"), 0, 0);
}