diff options
-rw-r--r-- | eval.c | 3 | ||||
-rw-r--r-- | file.c | 13 | ||||
-rw-r--r-- | numeric.c | 3 | ||||
-rw-r--r-- | string.c | 2 |
4 files changed, 10 insertions, 11 deletions
@@ -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)) @@ -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); } @@ -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(); @@ -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); |