mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* array.c (ary_resize_capa): use RARRAY_RAWPTR() because
this code creates no new references. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8eb0a3cd50
commit
8160fab8bc
2 changed files with 7 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Jul 22 13:19:22 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* array.c (ary_resize_capa): use RARRAY_RAWPTR() because
|
||||
this code creates no new references.
|
||||
|
||||
Mon Jul 22 12:58:18 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* array.c (ary_memfill): added.
|
||||
|
|
4
array.c
4
array.c
|
@ -263,12 +263,12 @@ ary_resize_capa(VALUE ary, long capacity)
|
|||
else {
|
||||
if (!ARY_EMBED_P(ary)) {
|
||||
long len = RARRAY_LEN(ary);
|
||||
VALUE *ptr = RARRAY_PTR(ary);
|
||||
const VALUE *ptr = RARRAY_RAWPTR(ary);
|
||||
if (len > capacity) len = capacity;
|
||||
MEMCPY((VALUE *)RARRAY(ary)->as.ary, ptr, VALUE, len);
|
||||
FL_SET_EMBED(ary);
|
||||
ARY_SET_LEN(ary, len);
|
||||
xfree(ptr);
|
||||
xfree((VALUE *)ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue