diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-06 07:49:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-06 07:49:24 +0000 |
commit | 98e65d9d921ec810bbae2233b80e865e76dd8502 (patch) | |
tree | 16ce055f3f2dfcedef55c4649e5eb3d7bf707040 /thread_sync.c | |
parent | 0cd28199e50039e9425f10b880c436d3ecacde0b (diff) | |
download | ruby-98e65d9d921ec810bbae2233b80e865e76dd8502.tar.gz |
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
Diffstat (limited to 'thread_sync.c')
-rw-r--r-- | thread_sync.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/thread_sync.c b/thread_sync.c index e478a96b88..4a3cb2ad6a 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -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); } |