summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Kanis <lars@greiz-reinsdorf.de>2023-04-19 09:19:37 +0200
committerGitHub <noreply@github.com>2023-04-19 09:19:37 +0200
commitb1003b82599ff387598e612da1db9c513bed22b5 (patch)
tree93726d62232ab74c48cd03eea72fe452fb87ec57
parent51bfb061af4aeb6ba5413eba68369c20b93ce6fd (diff)
parent17da66de237520cd3b6c307cc051c53a738598d9 (diff)
downloadffi-b1003b82599ff387598e612da1db9c513bed22b5.tar.gz
Merge pull request #1025 from peterzhu2118/pz-rarray-ptr
Remove use of RARRAY_PTR
-rw-r--r--ext/ffi_c/AbstractMemory.c2
-rw-r--r--ext/ffi_c/Struct.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/ext/ffi_c/AbstractMemory.c b/ext/ffi_c/AbstractMemory.c
index 3cf16a7..10ddc28 100644
--- a/ext/ffi_c/AbstractMemory.c
+++ b/ext/ffi_c/AbstractMemory.c
@@ -150,7 +150,7 @@ memory_put_array_of_##name(VALUE self, VALUE offset, VALUE ary) \
if (likely(count > 0)) checkWrite(memory); \
checkBounds(memory, off, count * sizeof(type)); \
for (i = 0; i < count; i++) { \
- type tmp = (type) VAL(toNative(RARRAY_PTR(ary)[i]), swap); \
+ type tmp = (type) VAL(toNative(RARRAY_AREF(ary, i)), swap); \
memcpy(memory->address + off + (i * sizeof(type)), &tmp, sizeof(tmp)); \
} \
return self; \
diff --git a/ext/ffi_c/Struct.c b/ext/ffi_c/Struct.c
index b9b6b2c..9eb10ec 100644
--- a/ext/ffi_c/Struct.c
+++ b/ext/ffi_c/Struct.c
@@ -132,7 +132,7 @@ struct_initialize(int argc, VALUE* argv, VALUE self)
/* Call up into ruby code to adjust the layout */
if (nargs > 1) {
- VALUE rbLayout = rb_funcall2(CLASS_OF(self), id_layout, (int) RARRAY_LEN(rest), RARRAY_PTR(rest));
+ VALUE rbLayout = rb_apply(CLASS_OF(self), id_layout, rest);
RB_OBJ_WRITE(self, &s->rbLayout, rbLayout);
} else {
RB_OBJ_WRITE(self, &s->rbLayout, struct_class_layout(klass));