compile.c: use ALLOCV_N
* compile.c (ibf_dump_object_list): allocate known-size array by ALLOCV_N instead of rb_ary_tmp_new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ce7ad3a84e
commit
823a4fe7d1
@ -9295,21 +9295,23 @@ ibf_load_object(const struct ibf_load *load, VALUE object_index)
|
|||||||
static void
|
static void
|
||||||
ibf_dump_object_list(struct ibf_dump *dump, struct ibf_header *header)
|
ibf_dump_object_list(struct ibf_dump *dump, struct ibf_header *header)
|
||||||
{
|
{
|
||||||
VALUE list = rb_ary_tmp_new(RARRAY_LEN(dump->obj_list));
|
VALUE listv;
|
||||||
|
ibf_offset_t *list = ALLOCV_N(ibf_offset_t, listv, RARRAY_LEN(dump->obj_list));
|
||||||
int i, size;
|
int i, size;
|
||||||
|
|
||||||
for (i=0; i<RARRAY_LEN(dump->obj_list); i++) {
|
for (i=0; i<RARRAY_LEN(dump->obj_list); i++) {
|
||||||
VALUE obj = RARRAY_AREF(dump->obj_list, i);
|
VALUE obj = RARRAY_AREF(dump->obj_list, i);
|
||||||
ibf_offset_t offset = lbf_dump_object_object(dump, obj);
|
ibf_offset_t offset = lbf_dump_object_object(dump, obj);
|
||||||
rb_ary_push(list, UINT2NUM(offset));
|
list[i] = offset;
|
||||||
}
|
}
|
||||||
size = i;
|
size = i;
|
||||||
header->object_list_offset = ibf_dump_pos(dump);
|
header->object_list_offset = ibf_dump_pos(dump);
|
||||||
|
|
||||||
for (i=0; i<size; i++) {
|
for (i=0; i<size; i++) {
|
||||||
ibf_offset_t offset = NUM2UINT(RARRAY_AREF(list, i));
|
ibf_offset_t offset = list[i];
|
||||||
IBF_WV(offset);
|
IBF_WV(offset);
|
||||||
}
|
}
|
||||||
|
ALLOCV_END(listv);
|
||||||
|
|
||||||
header->object_list_size = size;
|
header->object_list_size = size;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user