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 | 05e2cba4dc2d2ddd48bbe849acaaa511e181a1a6 (patch) | |
| tree | 3e6db7f9ecee480edff058e18bc7211a53296f64 /ext/readline | |
| parent | cf4b4b4ed9283d87497b661fc1ac5172db6030c4 (diff) | |
| download | ruby-05e2cba4dc2d2ddd48bbe849acaaa511e181a1a6.tar.gz ruby-05e2cba4dc2d2ddd48bbe849acaaa511e181a1a6.tar.xz ruby-05e2cba4dc2d2ddd48bbe849acaaa511e181a1a6.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/readline')
| -rw-r--r-- | ext/readline/readline.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 94aef8db6..1e6467517 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -170,12 +170,12 @@ readline_attempted_completion_function(const char *text, int start, int end) ary = rb_funcall(proc, rb_intern("call"), 1, rb_tainted_str_new2(text)); if (TYPE(ary) != T_ARRAY) ary = rb_Array(ary); - matches = RARRAY(ary)->len; + matches = RARRAY_LEN(ary); if (matches == 0) return NULL; result = ALLOC_N(char *, matches + 2); for (i = 0; i < matches; i++) { - temp = rb_obj_as_string(RARRAY(ary)->ptr[i]); + temp = rb_obj_as_string(RARRAY_PTR(ary)[i]); result[i + 1] = ALLOC_N(char, RSTRING_LEN(temp) + 1); strcpy(result[i + 1], RSTRING_PTR(temp)); } @@ -661,7 +661,7 @@ filename_completion_proc_call(VALUE self, VALUE str) free(matches[i]); } free(matches); - if (RARRAY(result)->len >= 2) + if (RARRAY_LEN(result) >= 2) rb_ary_shift(result); } else { @@ -686,7 +686,7 @@ username_completion_proc_call(VALUE self, VALUE str) free(matches[i]); } free(matches); - if (RARRAY(result)->len >= 2) + if (RARRAY_LEN(result) >= 2) rb_ary_shift(result); } else { |
