summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/dir.c b/dir.c
index 465f97c790..ecc0bd5e30 100644
--- a/dir.c
+++ b/dir.c
@@ -477,10 +477,7 @@ dir_inspect(VALUE dir)
Data_Get_Struct(dir, struct dir_data, dirp);
if (dirp->path) {
const char *c = rb_obj_classname(dir);
- int len = strlen(c) + strlen(dirp->path) + 4;
- VALUE s = rb_str_new(0, len);
- snprintf(RSTRING_PTR(s), len+1, "#<%s:%s>", c, dirp->path);
- return s;
+ return rb_sprintf("#<%s:%s>", c, dirp->path);
}
return rb_funcall(dir, rb_intern("to_s"), 0, 0);
}