diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-19 10:16:31 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-19 10:16:31 +0000 |
commit | 5ef247aa60049300428310ff38af5d7a798df416 (patch) | |
tree | 69be23672163bd16ee0d9317050b4d01eb1e42e7 | |
parent | 01bf495286cd0a0f24c4b18982630309566be527 (diff) | |
download | ruby-5ef247aa60049300428310ff38af5d7a798df416.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | array.c | 9 |
2 files changed, 10 insertions, 6 deletions
@@ -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; |