* array.c (rb_ary_resurrect): use RARRAY_RAWPTR() because there is no

writing.
* array.c (rb_ary_new_from_values): use ary_memcpy().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-07-19 10:16:31 +00:00
Родитель 01bf495286
Коммит 5ef247aa60
2 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Fri Jul 19 19:15:30 2013 Koichi Sasada <ko1@atdot.net>
* array.c (rb_ary_resurrect): use RARRAY_RAWPTR() because there is no
writing.
* array.c (rb_ary_new_from_values): use ary_memcpy().
Fri Jul 19 19:07:31 2013 Koichi Sasada <ko1@atdot.net>
* array.c (ary_memcpy): add a function to copy VALUEs into ary

Просмотреть файл

@ -11,7 +11,7 @@
**********************************************************************/
#define RGENGC_UNPROTECT_LOGGING 0
#define RGENGC_UNPROTECT_LOGGING 1
#if RGENGC_UNPROTECT_LOGGING
static void ary_unprotect_logging(void *x, const char *filename, int line);
#define RGENGC_LOGGING_WB_UNPROTECT(x, f, l) ary_unprotect_logging((void *)x, f, l)
@ -543,10 +543,7 @@ rb_ary_new_from_values(long n, const VALUE *elts)
ary = rb_ary_new2(n);
if (n > 0 && elts) {
assert(!OBJ_PROMOTED(ary));
RARRAY_PTR_USE(ary, ptr, {
MEMCPY(ptr, elts, VALUE, n); /* new array is not old gen */
});
ary_memcpy(ary, 0, n, elts);
ARY_SET_LEN(ary, n);
}
@ -1891,7 +1888,7 @@ rb_ary_dup(VALUE ary)
VALUE
rb_ary_resurrect(VALUE ary)
{
return rb_ary_new4(RARRAY_LEN(ary), RARRAY_PTR(ary));
return rb_ary_new4(RARRAY_LEN(ary), RARRAY_RAWPTR(ary));
}
extern VALUE rb_output_fs;