Skip to content

Commit

Permalink
Turned recur into int [Feature #15777]
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jun 21, 2019
1 parent fb85a42 commit 5b7cc63
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down
3 changes: 1 addition & 2 deletions load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5b7cc63

Please sign in to comment.