summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eval.c3
-rw-r--r--file.c13
-rw-r--r--numeric.c3
-rw-r--r--string.c2
4 files changed, 10 insertions, 11 deletions
diff --git a/eval.c b/eval.c
index fa3ec22af5..75648f1d8d 100644
--- a/eval.c
+++ b/eval.c
@@ -790,8 +790,7 @@ make_exception(int argc, const VALUE *argv, int isstr)
}
break;
default:
- rb_check_arity(argc, 0, 3);
- break;
+ rb_error_arity(argc, 0, 3);
}
if (argc > 0) {
if (!rb_obj_is_kind_of(mesg, rb_eException))
diff --git a/file.c b/file.c
index 50d1765d02..15970cb0d3 100644
--- a/file.c
+++ b/file.c
@@ -3219,15 +3219,16 @@ rb_file_s_umask(int argc, VALUE *argv)
{
mode_t omask = 0;
- if (argc == 0) {
+ switch (argc) {
+ case 0:
omask = umask(0);
umask(omask);
- }
- else if (argc == 1) {
+ break;
+ case 1:
omask = umask(NUM2MODET(argv[0]));
- }
- else {
- rb_check_arity(argc, 0, 1);
+ break;
+ default:
+ rb_error_arity(argc, 0, 1);
}
return MODET2NUM(omask);
}
diff --git a/numeric.c b/numeric.c
index 1fce19ac0b..90eabc29e0 100644
--- a/numeric.c
+++ b/numeric.c
@@ -3418,8 +3418,7 @@ int_chr(int argc, VALUE *argv, VALUE num)
case 1:
break;
default:
- rb_check_arity(argc, 0, 1);
- break;
+ rb_error_arity(argc, 0, 1);
}
enc = rb_to_encoding(argv[0]);
if (!enc) enc = rb_ascii8bit_encoding();
diff --git a/string.c b/string.c
index 8d7d2ad7b9..f76a417d45 100644
--- a/string.c
+++ b/string.c
@@ -5186,7 +5186,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
tainted = OBJ_TAINTED_RAW(repl);
break;
default:
- rb_check_arity(argc, 1, 2);
+ rb_error_arity(argc, 1, 2);
}
pat = get_pat_quoted(argv[0], 1);