1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-10-10 07:03:36 +00:00
parent ef45458e94
commit 1ce6f065b5
16 changed files with 113 additions and 74 deletions

View file

@ -338,10 +338,10 @@ rb_struct_to_s(s)
VALUE s;
{
char *cname = rb_class2name(CLASS_OF(s));
char *buf = ALLOCA_N(char, strlen(cname) + 4);
VALUE str = rb_str_new(0, strlen(cname) + 4);
sprintf(buf, "#<%s>", cname);
return rb_str_new2(buf);
sprintf(RSTRING(str)->ptr, "#<%s>", cname);
return str;
}
static VALUE
@ -386,10 +386,10 @@ rb_struct_inspect(s)
{
if (rb_inspecting_p(s)) {
char *cname = rb_class2name(CLASS_OF(s));
char *buf = ALLOCA_N(char, strlen(cname) + 8);
VALUE str = rb_str_new(0, strlen(cname) + 8);
sprintf(buf, "#<%s:...>", cname);
return rb_str_new2(buf);
sprintf(RSTRING(str)->ptr, "#<%s:...>", cname);
return str;
}
return rb_protect_inspect(inspect_struct, s, 0);
}