diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-06-26 15:27:18 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-06-26 17:05:27 +0900 |
commit | 4949df498a4ca67234c42f00b8e2b513a6a2b6c6 (patch) | |
tree | 9b44f70614695d41d1b20dcf9f4681a0fc0df67c /ext | |
parent | 40b40523dcf957fa9459c1c1037ad79d73867f83 (diff) | |
download | ruby-4949df498a4ca67234c42f00b8e2b513a6a2b6c6.tar.gz |
[ruby/fiddle] Fixed typos
https://github.com/ruby/fiddle/commit/a09e66adf4
https://github.com/ruby/fiddle/commit/6cab9b45d6
https://github.com/ruby/fiddle/commit/ab72b19bed
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fiddle/function.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c index 994402e26b..b624255f27 100644 --- a/ext/fiddle/function.c +++ b/ext/fiddle/function.c @@ -93,7 +93,7 @@ initialize(int argc, VALUE argv[], VALUE self) ffi_cif * cif; ffi_type **arg_types, *rtype; ffi_status result; - VALUE ptr, args, ret_type, abi, kwds, ary; + VALUE ptr, args, ret_type, abi, kwds; int i, len; int nabi; void *cfunc; @@ -113,14 +113,15 @@ initialize(int argc, VALUE argv[], VALUE self) Check_Type(args, T_ARRAY); len = RARRAY_LENINT(args); Check_Max_Args("args", len); - ary = rb_ary_subseq(args, 0, len); + /* freeze to prevent inconsistency at calling #to_int later */ + args = rb_ary_subseq(args, 0, len); for (i = 0; i < RARRAY_LEN(args); i++) { VALUE a = RARRAY_AREF(args, i); int type = NUM2INT(a); (void)INT2FFI_TYPE(type); /* raise */ - if (INT2FIX(type) != a) rb_ary_store(ary, i, INT2FIX(type)); + if (INT2FIX(type) != a) rb_ary_store(args, i, INT2FIX(type)); } - OBJ_FREEZE(ary); + OBJ_FREEZE(args); rb_iv_set(self, "@ptr", ptr); rb_iv_set(self, "@args", args); |