summaryrefslogtreecommitdiff
path: root/ext/dbm
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-02 14:42:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-02 14:42:08 +0000
commit2156870525be05f0bd769af141c3f6cff9fff8c4 (patch)
tree3e6db7f9ecee480edff058e18bc7211a53296f64 /ext/dbm
parent8581164ea67a13fad5e7d56aa4aa75a87f9eafb3 (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/dbm')
-rw-r--r--ext/dbm/dbm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 3bc1a83..e89f8b1 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -345,8 +345,8 @@ fdbm_delete_if(VALUE obj)
GetDBM2(obj, dbmp, dbm);
}
- for (i = 0; i < RARRAY(ary)->len; i++) {
- keystr = RARRAY(ary)->ptr[i];
+ for (i = 0; i < RARRAY_LEN(ary); i++) {
+ keystr = RARRAY_PTR(ary)[i];
StringValue(keystr);
key.dptr = RSTRING_PTR(keystr);
key.dsize = RSTRING_LEN(keystr);
@@ -355,7 +355,7 @@ fdbm_delete_if(VALUE obj)
}
}
if (status) rb_jump_tag(status);
- if (n > 0) dbmp->di_size = n - RARRAY(ary)->len;
+ if (n > 0) dbmp->di_size = n - RARRAY_LEN(ary);
return obj;
}
@@ -405,10 +405,10 @@ static VALUE
update_i(VALUE pair, VALUE dbm)
{
Check_Type(pair, T_ARRAY);
- if (RARRAY(pair)->len < 2) {
+ if (RARRAY_LEN(pair) < 2) {
rb_raise(rb_eArgError, "pair must be [key, value]");
}
- fdbm_store(dbm, RARRAY(pair)->ptr[0], RARRAY(pair)->ptr[1]);
+ fdbm_store(dbm, RARRAY_PTR(pair)[0], RARRAY_PTR(pair)[1]);
return Qnil;
}