]>
Commit | Line | Data |
---|---|---|
a45b94d8 JR |
1 | ext/fcgi/fcgi.c | 23 +++++++++++++---------- |
2 | 1 files changed, 13 insertions(+), 10 deletions(-) | |
3 | ||
4 | diff --git a/ext/fcgi/fcgi.c b/ext/fcgi/fcgi.c | |
5 | index 8539890..0e26b79 100755 | |
6 | --- a/ext/fcgi/fcgi.c | |
7 | +++ b/ext/fcgi/fcgi.c | |
8 | @@ -222,7 +222,7 @@ static VALUE fcgi_stream_write(VALUE self, VALUE str) | |
9 | rb_secure(4); | |
10 | Data_Get_Struct(self, FCGX_Stream, stream); | |
11 | str = rb_obj_as_string(str); | |
12 | - len = FCGX_PutStr(RSTRING(str)->ptr, RSTRING(str)->len, stream); | |
13 | + len = FCGX_PutStr(RSTRING_PTR(str), RSTRING_LEN(str), stream); | |
14 | if (len == EOF) CHECK_STREAM_ERROR(stream); | |
15 | return INT2NUM(len); | |
16 | } | |
17 | @@ -266,16 +266,19 @@ static VALUE fcgi_stream_printf(int argc, VALUE *argv, VALUE out) | |
18 | ||
19 | static VALUE fcgi_stream_puts _((int, VALUE*, VALUE)); | |
20 | ||
21 | -static VALUE fcgi_stream_puts_ary(VALUE ary, VALUE out) | |
22 | +static VALUE fcgi_stream_puts_ary(VALUE ary, VALUE out, int recur) | |
23 | { | |
24 | VALUE tmp; | |
25 | int i; | |
26 | ||
27 | - for (i=0; i<RARRAY(ary)->len; i++) { | |
28 | - tmp = RARRAY(ary)->ptr[i]; | |
29 | - if (rb_inspecting_p(tmp)) { | |
30 | - tmp = rb_str_new2("[...]"); | |
31 | - } | |
32 | + if (recur) { | |
33 | + tmp = rb_str_new2("[...]"); | |
34 | + fcgi_stream_puts(1, &tmp, out); | |
35 | + return Qnil; | |
36 | + } | |
37 | + | |
38 | + for (i=0; i<RARRAY_LEN(ary); i++) { | |
39 | + tmp = RARRAY_PTR(ary)[i]; | |
40 | fcgi_stream_puts(1, &tmp, out); | |
41 | } | |
42 | return Qnil; | |
43 | @@ -297,7 +300,7 @@ static VALUE fcgi_stream_puts(int argc, VALUE *argv, VALUE out) | |
44 | line = rb_str_new2("nil"); | |
45 | break; | |
46 | case T_ARRAY: | |
47 | - rb_protect_inspect(fcgi_stream_puts_ary, argv[i], out); | |
48 | + rb_exec_recursive(fcgi_stream_puts_ary, argv[i], out); | |
49 | continue; | |
50 | default: | |
51 | line = argv[i]; | |
52 | @@ -305,7 +308,7 @@ static VALUE fcgi_stream_puts(int argc, VALUE *argv, VALUE out) | |
53 | } | |
54 | line = rb_obj_as_string(line); | |
55 | fcgi_stream_write(out, line); | |
56 | - if (RSTRING(line)->ptr[RSTRING(line)->len-1] != '\n') { | |
57 | + if (RSTRING_PTR(line)[RSTRING_LEN(line)-1] != '\n') { | |
58 | fcgi_stream_write(out, rb_default_rs); | |
59 | } | |
60 | } | |
61 | @@ -379,7 +382,7 @@ static VALUE fcgi_stream_gets(VALUE self) | |
62 | rb_str_cat(str, buff, strlen(buff)); | |
63 | if (strchr(buff, '\n')) break; | |
64 | } | |
65 | - if (RSTRING(str)->len > 0) | |
66 | + if (RSTRING_LEN(str) > 0) | |
67 | return str; | |
68 | else | |
69 | return Qnil; |