mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 17:43:59 +02:00
Prefer rb_check_arity when 0 or 1 arguments
Especially over checking argc then calling rb_scan_args just to raise an ArgumentError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0cd28199e5
commit
98e65d9d92
18 changed files with 72 additions and 139 deletions
|
@ -517,7 +517,7 @@ mutex_sleep(int argc, VALUE *argv, VALUE self)
|
|||
{
|
||||
VALUE timeout;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &timeout);
|
||||
timeout = rb_check_arity(argc, 0, 1) ? argv[0] : Qnil;
|
||||
return rb_mutex_sleep(self, timeout);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue