Refactor ary_make_partial
This commit is contained in:
parent
314eed8a5e
commit
c8d6419985
4
array.c
4
array.c
@ -1200,7 +1200,6 @@ ary_make_partial(VALUE ary, VALUE klass, long offset, long len)
|
|||||||
FL_SET_EMBED(result);
|
FL_SET_EMBED(result);
|
||||||
ary_memcpy(result, 0, len, RARRAY_CONST_PTR(ary) + offset);
|
ary_memcpy(result, 0, len, RARRAY_CONST_PTR(ary) + offset);
|
||||||
ARY_SET_EMBED_LEN(result, len);
|
ARY_SET_EMBED_LEN(result, len);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VALUE shared = ary_make_shared(ary);
|
VALUE shared = ary_make_shared(ary);
|
||||||
@ -1215,9 +1214,10 @@ ary_make_partial(VALUE ary, VALUE klass, long offset, long len)
|
|||||||
ARY_SET_LEN(result, len);
|
ARY_SET_LEN(result, len);
|
||||||
|
|
||||||
ary_verify(shared);
|
ary_verify(shared);
|
||||||
|
}
|
||||||
|
|
||||||
ary_verify(result);
|
ary_verify(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user