From 2fed885b253b553592b05ab40a3f009dfcea0a41 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 22 Jul 2008 08:53:34 +0000 Subject: * compile.c (insn_data_to_s_detail), file.c (rb_stat_inspect), iseq.c (ruby_iseq_disasm_insn, ruby_iseq_disasm), process.c (pst_message), re.c (match_inspect): use rb_str_catf. * dir.c (dir_inspect), iseq.c (iseq_inspect, insn_operand_intern): use rb_sprintf. * error.c (rb_name_error, rb_raise, rb_loaderror, rb_fatal): use rb_vsprintf. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- dir.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'dir.c') diff --git a/dir.c b/dir.c index 465f97c79..ecc0bd5e3 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); } -- cgit