summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-10 07:03:36 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-10 07:03:36 +0000
commit1ce6f065b519284a5ad7135a6db77fcbe1aa778a (patch)
tree79c663a365cc039f46e51658f288538eade86658 /struct.c
parentef45458e9405c57ab4f59f648c4001ea4df30489 (diff)
downloadruby-1ce6f065b519284a5ad7135a6db77fcbe1aa778a.tar.gz
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/struct.c b/struct.c
index 31103a452b..4d9b81a7ca 100644
--- a/struct.c
+++ b/struct.c
@@ -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);
}