mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* 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
This commit is contained in:
parent
e6a02b9374
commit
6524f34a26
17 changed files with 200 additions and 132 deletions
12
struct.c
12
struct.c
|
@ -476,19 +476,11 @@ inspect_struct(s, dummy, recur)
|
|||
long i;
|
||||
|
||||
if (recur) {
|
||||
char *cname = rb_class2name(rb_obj_class(s));
|
||||
size_t len = strlen(cname) + 14;
|
||||
VALUE str = rb_str_new(0, len);
|
||||
|
||||
snprintf(RSTRING(str)->ptr, len+1, "#<struct %s:...>", cname);
|
||||
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
||||
return str;
|
||||
return rb_sprintf("#<struct %s:...>", cname);
|
||||
}
|
||||
|
||||
members = rb_struct_members(s);
|
||||
str = rb_str_buf_new2("#<struct ");
|
||||
rb_str_cat2(str, cname);
|
||||
rb_str_cat2(str, " ");
|
||||
str = rb_sprintf("#<struct %s ", cname);
|
||||
for (i=0; i<RSTRUCT(s)->len; i++) {
|
||||
VALUE slot;
|
||||
ID id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue