mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 04:55:21 +02:00
Prefer rb_check_arity when 0 or 1 arguments
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cfa6c55347
commit
09ef29a78f
5 changed files with 40 additions and 61 deletions
5
dir.c
5
dir.c
|
@ -1080,9 +1080,8 @@ dir_s_chdir(int argc, VALUE *argv, VALUE obj)
|
|||
{
|
||||
VALUE path = Qnil;
|
||||
|
||||
if (rb_scan_args(argc, argv, "01", &path) == 1) {
|
||||
FilePathValue(path);
|
||||
path = rb_str_encode_ospath(path);
|
||||
if (rb_check_arity(argc, 0, 1) == 1) {
|
||||
path = rb_str_encode_ospath(rb_get_path(argv[0]));
|
||||
}
|
||||
else {
|
||||
const char *dist = getenv("HOME");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue