Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More RB_OBJ_WRITE #1095

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/ffi_c/FunctionInfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ fntype_initialize(int argc, VALUE* argv, VALUE self)
Check_Type(rbParamTypes, T_ARRAY);

TypedData_Get_Struct(self, FunctionType, &rbffi_fntype_data_type, fnInfo);
fnInfo->parameterCount = (int) RARRAY_LEN(rbParamTypes);
fnInfo->parameterCount = RARRAY_LENINT(rbParamTypes);
fnInfo->parameterTypes = xcalloc(fnInfo->parameterCount, sizeof(*fnInfo->parameterTypes));
fnInfo->ffiParameterTypes = xcalloc(fnInfo->parameterCount, sizeof(ffi_type *));
fnInfo->nativeParameterTypes = xcalloc(fnInfo->parameterCount, sizeof(*fnInfo->nativeParameterTypes));
Expand Down
8 changes: 4 additions & 4 deletions ext/ffi_c/StructLayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ struct_layout_allocate(VALUE klass)
VALUE obj;

obj = TypedData_Make_Struct(klass, StructLayout, &rbffi_struct_layout_data_type, layout);
layout->rbFieldMap = Qnil;
layout->rbFieldNames = Qnil;
layout->rbFields = Qnil;
RB_OBJ_WRITE(obj, &layout->rbFieldMap, Qnil);
RB_OBJ_WRITE(obj, &layout->rbFieldNames, Qnil);
RB_OBJ_WRITE(obj, &layout->rbFields, Qnil);
layout->base.ffiType = xcalloc(1, sizeof(*layout->base.ffiType));
layout->base.ffiType->size = 0;
layout->base.ffiType->alignment = 0;
Expand All @@ -487,7 +487,7 @@ struct_layout_initialize(VALUE self, VALUE fields, VALUE size, VALUE align)
int i;

TypedData_Get_Struct(self, StructLayout, &rbffi_struct_layout_data_type, layout);
layout->fieldCount = (int) RARRAY_LEN(fields);
layout->fieldCount = RARRAY_LENINT(fields);
RB_OBJ_WRITE(self, &layout->rbFieldMap, rb_hash_new());
RB_OBJ_WRITE(self, &layout->rbFieldNames, rb_ary_new2(layout->fieldCount));
layout->size = (int) FFI_ALIGN(NUM2INT(size), NUM2INT(align));
Expand Down
2 changes: 1 addition & 1 deletion ext/ffi_c/Variadic.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues)
Check_Type(parameterValues, T_ARRAY);

TypedData_Get_Struct(self, VariadicInvoker, &variadic_data_type, invoker);
paramCount = (int) RARRAY_LEN(parameterTypes);
paramCount = RARRAY_LENINT(parameterTypes);
paramTypes = ALLOCA_N(Type *, paramCount);
ffiParamTypes = ALLOCA_N(ffi_type *, paramCount);
params = ALLOCA_N(FFIStorage, paramCount);
Expand Down