add macro ARY_SET_SHARED

This commit is contained in:
ksss
2014-02-27 00:10:42 +09:00
parent 3e4e90a708
commit 2f090879a5
+3 -2
View File
@@ -16,6 +16,7 @@
#define ARY_C_MAX_SIZE (SIZE_MAX / sizeof(mrb_value))
#define ARY_MAX_SIZE ((ARY_C_MAX_SIZE < (size_t)MRB_INT_MAX) ? (mrb_int)ARY_C_MAX_SIZE : MRB_INT_MAX-1)
#define ARY_SHARED_P(a) ((a)->flags & MRB_ARY_SHARED)
#define ARY_SET_SHARED(a) ((a)->flags |= MRB_ARY_SHARED)
static inline mrb_value
ary_elt(mrb_value ary, mrb_int offset)
@@ -173,7 +174,7 @@ ary_make_shared(mrb_state *mrb, struct RArray *a)
}
shared->len = a->len;
a->aux.shared = shared;
a->flags |= MRB_ARY_SHARED;
ARY_SET_SHARED(a);
}
}
@@ -671,7 +672,7 @@ ary_subseq(mrb_state *mrb, struct RArray *a, mrb_int beg, mrb_int len)
b->len = len;
b->aux.shared = a->aux.shared;
b->aux.shared->refcnt++;
b->flags |= MRB_ARY_SHARED;
ARY_SET_SHARED(b);
return mrb_obj_value(b);
}