summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-21 17:21:34 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-21 17:28:37 +0900
commit5b7cc63d114fbca641ce2d93c7b3f2117e38af60 (patch)
tree44ec0a8d6890ce5539e829a848a748cdfd709bef
parentfb85a428605265a8fd449b0702a4dd88cb6f3b20 (diff)
Turned `recur` into `int` [Feature #15777]
-rw-r--r--internal.h2
-rw-r--r--load.c3
-rw-r--r--variable.c6
3 files changed, 5 insertions, 6 deletions
diff --git a/internal.h b/internal.h
index 7443278a0f..c84461792f 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 a58498555c..7661616976 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 616c4852c0..297b5bb7d8 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;
}