From 2156870525be05f0bd769af141c3f6cff9fff8c4 Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 2 Sep 2006 14:42:08 +0000 Subject: * 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 --- file.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index e49005be97..712772ebf8 100644 --- a/file.c +++ b/file.c @@ -125,15 +125,14 @@ apply2files(void (*func)(const char *, void *), VALUE vargs, void *arg) { long i; VALUE path; - struct RArray *args = RARRAY(vargs); rb_secure(4); - for (i=0; ilen; i++) { - path = rb_get_path(args->ptr[i]); + for (i=0; ilen; + return RARRAY_LEN(vargs); } /* @@ -2875,12 +2874,12 @@ rb_file_join(VALUE ary, VALUE sep) VALUE result, tmp; char *name, *tail; - if (RARRAY(ary)->len == 0) return rb_str_new(0, 0); + if (RARRAY_LEN(ary) == 0) return rb_str_new(0, 0); len = 1; - for (i=0; ilen; i++) { - if (TYPE(RARRAY(ary)->ptr[i]) == T_STRING) { - len += RSTRING_LEN(RARRAY(ary)->ptr[i]); + for (i=0; ilen - 1; + len += RSTRING_LEN(sep) * RARRAY_LEN(ary) - 1; } result = rb_str_buf_new(len); OBJ_INFECT(result, ary); - for (i=0; ilen; i++) { - tmp = RARRAY(ary)->ptr[i]; + for (i=0; ilen;i++) { - VALUE str = RARRAY(rb_load_path)->ptr[i]; + for (i=0;ilen;i++) { - VALUE str = RARRAY(rb_load_path)->ptr[i]; + for (i=0;i 0) { rb_ary_push(tmp, str); -- cgit v1.2.1