diff --git a/internal.h b/internal.h index 7443278a0fbe35..c84461792fe686 100644 --- a/internal.h +++ b/internal.h @@ -2200,7 +2200,7 @@ VALUE rb_search_class_path(VALUE); VALUE rb_attr_delete(VALUE, ID); VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef); void rb_autoload_str(VALUE mod, ID id, VALUE file); -VALUE rb_autoload_at_p(VALUE, ID, VALUE); +VALUE rb_autoload_at_p(VALUE, ID, int); void rb_deprecate_constant(VALUE mod, const char *name); NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE)); rb_gvar_getter_t *rb_gvar_getter_function_of(const struct rb_global_entry *); diff --git a/load.c b/load.c index a58498555cd534..7661616976ea8f 100644 --- a/load.c +++ b/load.c @@ -1169,9 +1169,8 @@ rb_mod_autoload(VALUE mod, VALUE sym, VALUE file) static VALUE rb_mod_autoload_p(int argc, VALUE *argv, VALUE mod) { - rb_check_arity(argc, 1, 2); + int recur = (rb_check_arity(argc, 1, 2) == 1) ? TRUE : RTEST(argv[1]); VALUE sym = argv[0]; - VALUE recur = (argc == 1) ? Qtrue : argv[1]; ID id = rb_check_id(&sym); if (!id) { diff --git a/variable.c b/variable.c index 616c4852c0d40d..297b5bb7d838af 100644 --- a/variable.c +++ b/variable.c @@ -2332,17 +2332,17 @@ rb_autoload_load(VALUE mod, ID id) VALUE rb_autoload_p(VALUE mod, ID id) { - return rb_autoload_at_p(mod, id, Qtrue); + return rb_autoload_at_p(mod, id, TRUE); } VALUE -rb_autoload_at_p(VALUE mod, ID id, VALUE recur) +rb_autoload_at_p(VALUE mod, ID id, int recur) { VALUE load; struct autoload_data_i *ele; while (!autoload_defined_p(mod, id)) { - if (!RTEST(recur)) return Qnil; + if (!recur) return Qnil; mod = RCLASS_SUPER(mod); if (!mod) return Qnil; }