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/syck | |
parent | 8581164ea67a13fad5e7d56aa4aa75a87f9eafb3 (diff) |
* 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/syck')
-rw-r--r-- | ext/syck/rubyext.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c index d036d24451..371ef15599 100644 --- a/ext/syck/rubyext.c +++ b/ext/syck/rubyext.c @@ -1023,7 +1023,7 @@ syck_const_find(VALUE const_name) VALUE tclass = rb_cObject; VALUE tparts = rb_str_split( const_name, "::" ); int i = 0; - for ( i = 0; i < RARRAY(tparts)->len; i++ ) { + for ( i = 0; i < RARRAY_LEN(tparts); i++ ) { VALUE tpart = rb_to_id( rb_ary_entry( tparts, i ) ); if ( !rb_const_defined( tclass, tpart ) ) return Qnil; tclass = rb_const_get( tclass, tpart ); @@ -1059,7 +1059,7 @@ syck_resolver_transfer(VALUE self, VALUE type, VALUE val) VALUE subclass_parts = rb_ary_new(); VALUE parts = rb_str_split( type, ":" ); - while ( RARRAY(parts)->len > 1 ) + while ( RARRAY_LEN(parts) > 1 ) { VALUE partial; rb_ary_unshift( subclass_parts, rb_ary_pop( parts ) ); @@ -1077,7 +1077,7 @@ syck_resolver_transfer(VALUE self, VALUE type, VALUE val) if ( ! NIL_P( target_class ) ) { subclass = target_class; - if ( RARRAY(subclass_parts)->len > 0 && rb_respond_to( target_class, s_tag_subclasses ) && + if ( RARRAY_LEN(subclass_parts) > 0 && rb_respond_to( target_class, s_tag_subclasses ) && RTEST( rb_funcall( target_class, s_tag_subclasses, 0 ) ) ) { VALUE subclass_v; @@ -1502,7 +1502,7 @@ syck_seq_value_set(VALUE self, VALUE val) if ( !NIL_P( val ) ) { int i; syck_seq_empty( node ); - for ( i = 0; i < RARRAY( val )->len; i++ ) + for ( i = 0; i < RARRAY_LEN( val ); i++ ) { syck_seq_add( node, rb_ary_entry(val, i) ); } @@ -1587,7 +1587,7 @@ syck_map_initialize(VALUE self, VALUE type_id, VALUE val, VALUE style) } keys = rb_funcall( hsh, s_keys, 0 ); - for ( i = 0; i < RARRAY(keys)->len; i++ ) + for ( i = 0; i < RARRAY_LEN(keys); i++ ) { VALUE key = rb_ary_entry(keys, i); syck_map_add( node, key, rb_hash_aref(hsh, key) ); @@ -1622,7 +1622,7 @@ syck_map_value_set(VALUE self, VALUE val) syck_map_empty( node ); keys = rb_funcall( hsh, s_keys, 0 ); - for ( i = 0; i < RARRAY(keys)->len; i++ ) + for ( i = 0; i < RARRAY_LEN(keys); i++ ) { VALUE key = rb_ary_entry(keys, i); syck_map_add( node, key, rb_hash_aref(hsh, key) ); |