Bug #7158 » 0002-Expose-whether-two-arrays-are-shared-read-only-C-onl.patch
ChangeLog | ||
---|---|---|
Tue Sep 4 14:16:52 2012 Greg Price <price@mit.edu>
|
||
* array.c (rb_ary_shared_with_p): new function.
|
||
* include/ruby/intern.h (rb_ary_shared_with_p): declare.
|
||
Tue Sep 4 14:13:51 2012 Greg Price <price@mit.edu>
|
||
* load.c (loaded_feature_path): clarify and briefly comment
|
array.c | ||
---|---|---|
return Qfalse;
|
||
}
|
||
/* This can be used to take a snapshot of an array (with
|
||
e.g. rb_ary_replace) and check later whether the array has been
|
||
modified from the snapshot. The snapshot is cheap, though if
|
||
something does modify the array it will pay the cost of copying
|
||
it. */
|
||
VALUE
|
||
rb_ary_shared_with_p(VALUE ary1, VALUE ary2)
|
||
{
|
||
if (!ARY_EMBED_P(ary1) && ARY_SHARED_P(ary1)
|
||
&& !ARY_EMBED_P(ary2) && ARY_SHARED_P(ary2)
|
||
&& RARRAY(ary1)->as.heap.aux.shared == RARRAY(ary2)->as.heap.aux.shared) {
|
||
return Qtrue;
|
||
}
|
||
return Qfalse;
|
||
}
|
||
static VALUE
|
||
ary_alloc(VALUE klass)
|
||
{
|
include/ruby/intern.h | ||
---|---|---|
void rb_ary_free(VALUE);
|
||
void rb_ary_modify(VALUE);
|
||
VALUE rb_ary_freeze(VALUE);
|
||
VALUE rb_ary_shared_with_p(VALUE, VALUE);
|
||
VALUE rb_ary_aref(int, VALUE*, VALUE);
|
||
VALUE rb_ary_subseq(VALUE, long, long);
|
||
void rb_ary_store(VALUE, long, VALUE);
|