Skip to content

Commit

Permalink
Cast via VALUE function pointer between object pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Oct 10, 2024
1 parent d76c87b commit 477be27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/fiddle/function.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ function_call(int argc, VALUE argv[], VALUE self)
args.values[i_call] = (void *)&generic_args[i_call];
}
args.values[i_call] = NULL;
args.fn = (void(*)(void))NUM2PTR(cfunc);
args.fn = (void(*)(void))(VALUE)NUM2PTR(cfunc);

if (RTEST(need_gvl)) {
ffi_call(args.cif, args.fn, &(args.retval), args.values);
Expand Down
2 changes: 1 addition & 1 deletion ext/fiddle/pointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ rb_fiddle_ptr_inspect(VALUE self)

TypedData_Get_Struct(self, struct ptr_data, &fiddle_ptr_data_type, data);
return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>",
RB_OBJ_CLASSNAME(self), (void *)data, data->ptr, data->size, (void *)data->free);
RB_OBJ_CLASSNAME(self), (void *)data, data->ptr, data->size, (void *)(VALUE)data->free);
}

/*
Expand Down

0 comments on commit 477be27

Please sign in to comment.