зеркало из https://github.com/github/ruby.git
* array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB because
there are not new relations. * enum.c (enum_sort_by): ditto. * struct.c (setup_struct): use RARRAY_RAWPTR(). * vm_eval.c (yield_under): ditto. * ext/pathname/pathname.c (path_entries): use RARRAY_AREF(). * ext/pathname/pathname.c (path_s_glob): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
bf2a494ebc
Коммит
ad0ef29da7
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
Mon Aug 26 14:44:26 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB because
|
||||
there are not new relations.
|
||||
|
||||
* enum.c (enum_sort_by): ditto.
|
||||
|
||||
* struct.c (setup_struct): use RARRAY_RAWPTR().
|
||||
|
||||
* vm_eval.c (yield_under): ditto.
|
||||
|
||||
* ext/pathname/pathname.c (path_entries): use RARRAY_AREF().
|
||||
|
||||
* ext/pathname/pathname.c (path_s_glob): ditto.
|
||||
|
||||
Mon Aug 26 13:11:10 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||
|
||||
* array.c (ary_ensure_room_for_push): fix typo in r42658.
|
||||
|
|
5
array.c
5
array.c
|
@ -1545,8 +1545,9 @@ rb_ary_splice(VALUE ary, long beg, long len, VALUE rpl)
|
|||
}
|
||||
|
||||
if (len != rlen) {
|
||||
MEMMOVE(RARRAY_PTR(ary) + beg + rlen, RARRAY_PTR(ary) + beg + len,
|
||||
VALUE, RARRAY_LEN(ary) - (beg + len));
|
||||
RARRAY_PTR_USE(ary, ptr,
|
||||
MEMMOVE(ptr + beg + rlen, ptr + beg + len,
|
||||
VALUE, RARRAY_LEN(ary) - (beg + len)));
|
||||
ARY_SET_LEN(ary, alen);
|
||||
}
|
||||
if (rlen > 0) {
|
||||
|
|
5
enum.c
5
enum.c
|
@ -944,8 +944,9 @@ enum_sort_by(VALUE obj)
|
|||
rb_ary_concat(ary, buf);
|
||||
}
|
||||
if (RARRAY_LEN(ary) > 2) {
|
||||
ruby_qsort(RARRAY_PTR(ary), RARRAY_LEN(ary)/2, 2*sizeof(VALUE),
|
||||
sort_by_cmp, (void *)ary);
|
||||
RARRAY_PTR_USE(ary, ptr,
|
||||
ruby_qsort(ptr, RARRAY_LEN(ary)/2, 2*sizeof(VALUE),
|
||||
sort_by_cmp, (void *)ary));
|
||||
}
|
||||
if (RBASIC(ary)->klass) {
|
||||
rb_raise(rb_eRuntimeError, "sort_by reentered");
|
||||
|
|
|
@ -997,7 +997,7 @@ path_s_glob(int argc, VALUE *argv, VALUE klass)
|
|||
ary = rb_funcall2(rb_cDir, rb_intern("glob"), n, args);
|
||||
ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
|
||||
for (i = 0; i < RARRAY_LEN(ary); i++) {
|
||||
VALUE elt = RARRAY_PTR(ary)[i];
|
||||
VALUE elt = RARRAY_AREF(ary, i);
|
||||
elt = rb_class_new_instance(1, &elt, klass);
|
||||
rb_ary_store(ary, i, elt);
|
||||
}
|
||||
|
@ -1057,7 +1057,7 @@ path_entries(VALUE self)
|
|||
ary = rb_funcall(rb_cDir, rb_intern("entries"), 1, str);
|
||||
ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
|
||||
for (i = 0; i < RARRAY_LEN(ary); i++) {
|
||||
VALUE elt = RARRAY_PTR(ary)[i];
|
||||
VALUE elt = RARRAY_AREF(ary, i);
|
||||
elt = rb_class_new_instance(1, &elt, klass);
|
||||
rb_ary_store(ary, i, elt);
|
||||
}
|
||||
|
|
4
struct.c
4
struct.c
|
@ -197,7 +197,7 @@ new_struct(VALUE name, VALUE super)
|
|||
static VALUE
|
||||
setup_struct(VALUE nstr, VALUE members)
|
||||
{
|
||||
VALUE *ptr_members;
|
||||
const VALUE *ptr_members;
|
||||
long i, len;
|
||||
|
||||
OBJ_FREEZE(members);
|
||||
|
@ -207,7 +207,7 @@ setup_struct(VALUE nstr, VALUE members)
|
|||
rb_define_singleton_method(nstr, "new", rb_class_new_instance, -1);
|
||||
rb_define_singleton_method(nstr, "[]", rb_class_new_instance, -1);
|
||||
rb_define_singleton_method(nstr, "members", rb_struct_s_members_m, 0);
|
||||
ptr_members = RARRAY_PTR(members);
|
||||
ptr_members = RARRAY_RAWPTR(members);
|
||||
len = RARRAY_LEN(members);
|
||||
for (i=0; i< len; i++) {
|
||||
ID id = SYM2ID(ptr_members[i]);
|
||||
|
|
|
@ -1510,7 +1510,7 @@ yield_under(VALUE under, VALUE self, VALUE values)
|
|||
return vm_yield_with_cref(th, 1, &self, cref);
|
||||
}
|
||||
else {
|
||||
return vm_yield_with_cref(th, RARRAY_LENINT(values), RARRAY_PTR(values), cref);
|
||||
return vm_yield_with_cref(th, RARRAY_LENINT(values), RARRAY_RAWPTR(values), cref);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче