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 --- marshal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'marshal.c') diff --git a/marshal.c b/marshal.c index 2e69af00ed..0d9e85268b 100644 --- a/marshal.c +++ b/marshal.c @@ -552,8 +552,8 @@ w_object(VALUE obj, struct dump_arg *arg, int limit) w_uclass(obj, rb_cArray, arg); w_byte(TYPE_ARRAY, arg); { - long len = RARRAY(obj)->len; - VALUE *ptr = RARRAY(obj)->ptr; + long len = RARRAY_LEN(obj); + VALUE *ptr = RARRAY_PTR(obj); w_long(len, arg); while (len--) { @@ -592,7 +592,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit) w_long(len, arg); mem = rb_struct_members(obj); for (i=0; iptr[i]), arg); + w_symbol(SYM2ID(RARRAY_PTR(mem)[i]), arg); w_object(RSTRUCT_PTR(obj)[i], arg, limit); } } @@ -963,7 +963,7 @@ r_object0(struct load_arg *arg, VALUE proc, int *ivp, VALUE extmod) rb_ary_push(extmod, m); v = r_object0(arg, 0, 0, extmod); - while (RARRAY(extmod)->len > 0) { + while (RARRAY_LEN(extmod) > 0) { m = rb_ary_pop(extmod); rb_extend_object(v, m); } @@ -1145,11 +1145,11 @@ r_object0(struct load_arg *arg, VALUE proc, int *ivp, VALUE extmod) for (i=0; iptr[i] != ID2SYM(slot)) { + if (RARRAY_PTR(mem)[i] != ID2SYM(slot)) { rb_raise(rb_eTypeError, "struct %s not compatible (:%s for :%s)", rb_class2name(klass), rb_id2name(slot), - rb_id2name(SYM2ID(RARRAY(mem)->ptr[i]))); + rb_id2name(SYM2ID(RARRAY_PTR(mem)[i]))); } rb_struct_aset(v, LONG2FIX(i), r_object(arg)); } @@ -1182,7 +1182,7 @@ r_object0(struct load_arg *arg, VALUE proc, int *ivp, VALUE extmod) v = rb_obj_alloc(klass); if (! NIL_P(extmod)) { - while (RARRAY(extmod)->len > 0) { + while (RARRAY_LEN(extmod) > 0) { VALUE m = rb_ary_pop(extmod); rb_extend_object(v, m); } -- cgit v1.2.3