diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-10-10 07:03:36 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-10-10 07:03:36 +0000 |
commit | 1ce6f065b519284a5ad7135a6db77fcbe1aa778a (patch) | |
tree | 79c663a365cc039f46e51658f288538eade86658 /struct.c | |
parent | ef45458e9405c57ab4f59f648c4001ea4df30489 (diff) | |
download | ruby-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.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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); } |