summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-23 01:02:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-23 01:02:18 +0000
commit6524f34a2688436249d111a3456a097c7111722c (patch)
treef9c83bf95a7873e01e38ff396a8bc5490b61162c /io.c
parente6a02b93747266925fd536a30715352bf2c60c07 (diff)
* sprintf.c (rb_vsprintf, rb_sprintf): new functions return new String,
using missing/vsnprintf.c. [ruby-dev:26580] * missing/vsnprintf.c: made the output changeable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/io.c b/io.c
index e128a1b8c1..020ed7e873 100644
--- a/io.c
+++ b/io.c
@@ -1093,19 +1093,14 @@ rb_io_inspect(obj)
{
OpenFile *fptr;
char *buf, *cname, *st = "";
- long len;
fptr = RFILE(rb_io_taint_check(obj))->fptr;
if (!fptr || !fptr->path) return rb_any_to_s(obj);
cname = rb_obj_classname(obj);
- len = strlen(cname) + strlen(fptr->path) + 5;
if (fptr->fd < 0) {
st = " (closed)";
- len += 9;
}
- buf = ALLOCA_N(char, len);
- snprintf(buf, len, "#<%s:%s%s>", cname, fptr->path, st);
- return rb_str_new2(buf);
+ return rb_sprintf("#<%s:%s%s>", cname, fptr->path, st);
}
/*