summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-05 01:09:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-05 01:09:44 +0000
commit09ef29a78fc960eaec1ecafbeef75b6eb29abf96 (patch)
treed1f37d8ed45b27706d1d91a2f14ed54fc54423de /dir.c
parentcfa6c55347d037b152a4b93a390c73dfee6dccbd (diff)
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
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/dir.c b/dir.c
index 6ed53af..2f38e35 100644
--- a/dir.c
+++ b/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");