[前][次][番号順一覧][スレッド一覧]

ruby-changes:56176

From: Nobuyoshi <ko1@a...>
Date: Fri, 21 Jun 2019 17:29:07 +0900 (JST)
Subject: [ruby-changes:56176] Nobuyoshi Nakada: 5b7cc63d11 (trunk): Turned `recur` into `int` [Feature #15777]

https://git.ruby-lang.org/ruby.git/commit/?id=5b7cc63d11

From 5b7cc63d114fbca641ce2d93c7b3f2117e38af60 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 21 Jun 2019 17:21:34 +0900
Subject: Turned `recur` into `int` [Feature #15777]


diff --git a/internal.h b/internal.h
index 7443278..c844617 100644
--- a/internal.h
+++ b/internal.h
@@ -2200,7 +2200,7 @@ VALUE rb_search_class_path(VALUE); https://github.com/ruby/ruby/blob/trunk/internal.h#L2200
 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 a584985..7661616 100644
--- a/load.c
+++ b/load.c
@@ -1169,9 +1169,8 @@ rb_mod_autoload(VALUE mod, VALUE sym, VALUE file) https://github.com/ruby/ruby/blob/trunk/load.c#L1169
 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 616c485..297b5bb 100644
--- a/variable.c
+++ b/variable.c
@@ -2332,17 +2332,17 @@ rb_autoload_load(VALUE mod, ID id) https://github.com/ruby/ruby/blob/trunk/variable.c#L2332
 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;
     }
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]