summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-02-12 09:31:28 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-02-12 09:31:28 +0900
commit26781692b79425195c9c0864b6cb729e320cbf49 (patch)
tree92794dcd0ed8e3da4b5a64db2f7aa354f0d139d9 /include
parent4558b29719c119ffd9aa71dfa42fee72bf7e1db1 (diff)
parent7691b649634166bfc769ba58edcbe91aced50828 (diff)
downloadmruby-26781692b79425195c9c0864b6cb729e320cbf49.tar.gz
mruby-26781692b79425195c9c0864b6cb729e320cbf49.zip
Merge pull request #1697 from cremno/array-changes
array implementation: several small changes
Diffstat (limited to 'include')
-rw-r--r--include/mruby/array.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/mruby/array.h b/include/mruby/array.h
index 5a064cb37..5fbf71174 100644
--- a/include/mruby/array.h
+++ b/include/mruby/array.h
@@ -13,8 +13,8 @@ extern "C" {
typedef struct mrb_shared_array {
int refcnt;
- mrb_value *ptr;
mrb_int len;
+ mrb_value *ptr;
} mrb_shared_array;
struct RArray {
@@ -40,23 +40,29 @@ void mrb_ary_decref(mrb_state*, mrb_shared_array*);
mrb_value mrb_ary_new_capa(mrb_state*, mrb_int);
mrb_value mrb_ary_new(mrb_state *mrb);
mrb_value mrb_ary_new_from_values(mrb_state *mrb, mrb_int size, const mrb_value *vals);
+mrb_value mrb_assoc_new(mrb_state *mrb, mrb_value car, mrb_value cdr);
void mrb_ary_concat(mrb_state*, mrb_value, mrb_value);
mrb_value mrb_ary_splat(mrb_state*, mrb_value);
void mrb_ary_push(mrb_state*, mrb_value, mrb_value);
mrb_value mrb_ary_pop(mrb_state *mrb, mrb_value ary);
-mrb_value mrb_ary_aget(mrb_state *mrb, mrb_value self);
mrb_value mrb_ary_ref(mrb_state *mrb, mrb_value ary, mrb_int n);
void mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val);
-mrb_int mrb_ary_len(mrb_state *mrb, mrb_value ary);
void mrb_ary_replace(mrb_state *mrb, mrb_value a, mrb_value b);
mrb_value mrb_check_array_type(mrb_state *mrb, mrb_value self);
mrb_value mrb_ary_unshift(mrb_state *mrb, mrb_value self, mrb_value item);
-mrb_value mrb_assoc_new(mrb_state *mrb, mrb_value car, mrb_value cdr);
mrb_value mrb_ary_entry(mrb_value ary, mrb_int offset);
mrb_value mrb_ary_shift(mrb_state *mrb, mrb_value self);
mrb_value mrb_ary_clear(mrb_state *mrb, mrb_value self);
mrb_value mrb_ary_join(mrb_state *mrb, mrb_value ary, mrb_value sep);
+static inline mrb_int
+mrb_ary_len(mrb_state *mrb, mrb_value ary)
+{
+ (void)mrb;
+ mrb_assert(mrb_array_p(ary));
+ return RARRAY_LEN(ary);
+}
+
#if defined(__cplusplus)
} /* extern "C" { */
#endif