зеркало из https://github.com/github/ruby.git
use rb_check_hash_type
* class.c (rb_scan_args): use rb_check_hash_type. * process.c (rb_exec_getargs): ditto. * sprintf.c (get_hash): ditto. * string.c (rb_str_sub_bang, str_gsub): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9ac51c2993
Коммит
ffa20cf154
2
class.c
2
class.c
|
@ -1463,7 +1463,7 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
|
|||
argc--;
|
||||
}
|
||||
else {
|
||||
hash = rb_check_convert_type(last, T_HASH, "Hash", "to_hash");
|
||||
hash = rb_check_hash_type(last);
|
||||
if (!NIL_P(hash))
|
||||
argc--;
|
||||
}
|
||||
|
|
|
@ -1843,7 +1843,7 @@ rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, V
|
|||
VALUE hash, prog;
|
||||
|
||||
if (0 < *argc_p) {
|
||||
hash = rb_check_convert_type((*argv_p)[*argc_p-1], T_HASH, "Hash", "to_hash");
|
||||
hash = rb_check_hash_type((*argv_p)[*argc_p-1]);
|
||||
if (!NIL_P(hash)) {
|
||||
*opthash_ret = hash;
|
||||
(*argc_p)--;
|
||||
|
@ -1851,7 +1851,7 @@ rb_exec_getargs(int *argc_p, VALUE **argv_p, int accept_shell, VALUE *env_ret, V
|
|||
}
|
||||
|
||||
if (0 < *argc_p) {
|
||||
hash = rb_check_convert_type((*argv_p)[0], T_HASH, "Hash", "to_hash");
|
||||
hash = rb_check_hash_type((*argv_p)[0]);
|
||||
if (!NIL_P(hash)) {
|
||||
*env_ret = hash;
|
||||
(*argc_p)--;
|
||||
|
|
|
@ -161,7 +161,7 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv)
|
|||
if (argc != 2) {
|
||||
rb_raise(rb_eArgError, "one hash required");
|
||||
}
|
||||
tmp = rb_check_convert_type(argv[1], T_HASH, "Hash", "to_hash");
|
||||
tmp = rb_check_hash_type(argv[1]);
|
||||
if (NIL_P(tmp)) {
|
||||
rb_raise(rb_eArgError, "one hash required");
|
||||
}
|
||||
|
|
4
string.c
4
string.c
|
@ -3616,7 +3616,7 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
|
|||
}
|
||||
else {
|
||||
repl = argv[1];
|
||||
hash = rb_check_convert_type(argv[1], T_HASH, "Hash", "to_hash");
|
||||
hash = rb_check_hash_type(argv[1]);
|
||||
if (NIL_P(hash)) {
|
||||
StringValue(repl);
|
||||
}
|
||||
|
@ -3768,7 +3768,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
|
|||
break;
|
||||
case 2:
|
||||
repl = argv[1];
|
||||
hash = rb_check_convert_type(argv[1], T_HASH, "Hash", "to_hash");
|
||||
hash = rb_check_hash_type(argv[1]);
|
||||
if (NIL_P(hash)) {
|
||||
StringValue(repl);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче