diff options
author | Benoit Daloze <[email protected]> | 2022-08-29 15:36:29 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2022-08-29 15:36:29 +0200 |
commit | 4ee1a687768338a1928014fc6042c320a1a1af3e (patch) | |
tree | 37c1717dcd7a2a757e343a41b827fd096397fbca /spec/ruby/optional/capi/ext/util_spec.c | |
parent | a319d3cfdc1afef8497321fee7f690052b16739c (diff) |
Update to ruby/spec@d01709f
Diffstat (limited to 'spec/ruby/optional/capi/ext/util_spec.c')
-rw-r--r-- | spec/ruby/optional/capi/ext/util_spec.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/spec/ruby/optional/capi/ext/util_spec.c b/spec/ruby/optional/capi/ext/util_spec.c index a7269353c2..95ba71ea9d 100644 --- a/spec/ruby/optional/capi/ext/util_spec.c +++ b/spec/ruby/optional/capi/ext/util_spec.c @@ -7,15 +7,18 @@ extern "C" { #endif VALUE util_spec_rb_scan_args(VALUE self, VALUE argv, VALUE fmt, VALUE expected, VALUE acc) { - int i, result, argc = (int)RARRAY_LEN(argv); - VALUE args[6], failed, a1, a2, a3, a4, a5, a6; - - failed = rb_intern("failed"); - a1 = a2 = a3 = a4 = a5 = a6 = failed; - - for(i = 0; i < argc; i++) { - args[i] = rb_ary_entry(argv, i); - } + int result, argc; + VALUE a1, a2, a3, a4, a5, a6; + + argc = (int) RARRAY_LEN(argv); + VALUE* args = RARRAY_PTR(argv); + /* the line above can be replaced with this for Ruby implementations which do not support RARRAY_PTR() yet + VALUE args[6]; + for(int i = 0; i < argc; i++) { + args[i] = rb_ary_entry(argv, i); + } */ + + a1 = a2 = a3 = a4 = a5 = a6 = INT2FIX(-1); #ifdef RB_SCAN_ARGS_KEYWORDS if (*RSTRING_PTR(fmt) == 'k') { |