1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

use rb_check_arity [ci skip]

* ext: use rb_check_arity and rb_error_arity to raise
  ArgumentError.  [Feature #9025]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-25 00:43:06 +00:00
parent 94bdb010f6
commit 898fd2ed2a
7 changed files with 9 additions and 23 deletions

View file

@ -144,9 +144,8 @@ function_call(int argc, VALUE argv[], VALUE self)
cPointer = rb_const_get(mFiddle, rb_intern("Pointer"));
Check_Max_Args("number of arguments", argc);
if(argc != RARRAY_LENINT(types)) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
argc, RARRAY_LENINT(types));
if (argc != (i = RARRAY_LENINT(types))) {
rb_error_arity(argc, i, i);
}
TypedData_Get_Struct(self, ffi_cif, &function_data_type, cif);