Fix MEMMOVE in rb_darray_insert

Ruby's MEMMOVE takes in the element data type for the third argument, not
the size of the element. What this did was do sizeof(sizeof( ... )) which
always returned sizeof(size_t).
This commit is contained in:
Peter Zhu 2024-12-23 10:55:49 -05:00
parent 13e6fe9bbc
commit 07e89bde46
Notes: git 2024-12-24 14:40:30 +00:00

View File

@ -58,7 +58,7 @@
MEMMOVE( \ MEMMOVE( \
rb_darray_ref(*(ptr_to_ary), idx + 1), \ rb_darray_ref(*(ptr_to_ary), idx + 1), \
rb_darray_ref(*(ptr_to_ary), idx), \ rb_darray_ref(*(ptr_to_ary), idx), \
sizeof((*(ptr_to_ary))->data[0]), \ (*(ptr_to_ary))->data[0], \
rb_darray_size(*(ptr_to_ary)) - idx); \ rb_darray_size(*(ptr_to_ary)) - idx); \
rb_darray_set(*(ptr_to_ary), idx, element); \ rb_darray_set(*(ptr_to_ary), idx, element); \
(*(ptr_to_ary))->meta.size++; \ (*(ptr_to_ary))->meta.size++; \