diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-02 14:42:08 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-02 14:42:08 +0000 |
commit | 2156870525be05f0bd769af141c3f6cff9fff8c4 (patch) | |
tree | 3e6db7f9ecee480edff058e18bc7211a53296f64 /ext/socket/socket.c | |
parent | 8581164ea67a13fad5e7d56aa4aa75a87f9eafb3 (diff) | |
download | ruby-2156870525be05f0bd769af141c3f6cff9fff8c4.tar.gz |
* ruby.h (struct RArray): embed small arrays.
(RARRAY_LEN): defined for accessing array members.
(RARRAY_PTR): ditto.
* array.c: use RARRAY_LEN and RARRAY_PTR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index e2e691a141..8cc850b8a1 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -2991,7 +2991,7 @@ make_addrinfo(struct addrinfo *res0) for (res = res0; res; res = res->ai_next) { ary = ipaddr(res->ai_addr, do_not_reverse_lookup); if (res->ai_canonname) { - RARRAY(ary)->ptr[2] = rb_str_new2(res->ai_canonname); + RARRAY_PTR(ary)[2] = rb_str_new2(res->ai_canonname); } rb_ary_push(ary, INT2FIX(res->ai_family)); rb_ary_push(ary, INT2FIX(res->ai_socktype)); @@ -3232,17 +3232,17 @@ sock_s_getnameinfo(int argc, VALUE *argv) if (!NIL_P(tmp)) { sa = tmp; MEMZERO(&hints, struct addrinfo, 1); - if (RARRAY(sa)->len == 3) { - af = RARRAY(sa)->ptr[0]; - port = RARRAY(sa)->ptr[1]; - host = RARRAY(sa)->ptr[2]; + if (RARRAY_LEN(sa) == 3) { + af = RARRAY_PTR(sa)[0]; + port = RARRAY_PTR(sa)[1]; + host = RARRAY_PTR(sa)[2]; } - else if (RARRAY(sa)->len >= 4) { - af = RARRAY(sa)->ptr[0]; - port = RARRAY(sa)->ptr[1]; - host = RARRAY(sa)->ptr[3]; + else if (RARRAY_LEN(sa) >= 4) { + af = RARRAY_PTR(sa)[0]; + port = RARRAY_PTR(sa)[1]; + host = RARRAY_PTR(sa)[3]; if (NIL_P(host)) { - host = RARRAY(sa)->ptr[2]; + host = RARRAY_PTR(sa)[2]; } else { /* @@ -3256,7 +3256,7 @@ sock_s_getnameinfo(int argc, VALUE *argv) } else { rb_raise(rb_eArgError, "array size should be 3 or 4, %ld given", - RARRAY(sa)->len); + RARRAY_LEN(sa)); } /* host */ if (NIL_P(host)) { |