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

ruby-changes:58907

From: Kazuhiro <ko1@a...>
Date: Mon, 25 Nov 2019 15:09:35 +0900 (JST)
Subject: [ruby-changes:58907] 09e76e9828 (master): Improve consistency of bool/true/false

https://git.ruby-lang.org/ruby.git/commit/?id=09e76e9828

From 09e76e982801a838688ea80be29844ed91c23f46 Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Mon, 25 Nov 2019 15:05:53 +0900
Subject: Improve consistency of bool/true/false


diff --git a/complex.c b/complex.c
index 144a59d..cdd5edc 100644
--- a/complex.c
+++ b/complex.c
@@ -235,19 +235,19 @@ f_negate(VALUE x) https://github.com/ruby/ruby/blob/trunk/complex.c#L235
     return rb_funcall(x, id_negate, 0);
 }
 
-static VALUE nucomp_real_p(VALUE self);
+static bool nucomp_real_p(VALUE self);
 
 static inline bool
 f_real_p(VALUE x)
 {
     if (RB_INTEGER_TYPE_P(x)) {
-        return TRUE;
+        return true;
     }
     else if (RB_FLOAT_TYPE_P(x)) {
-        return TRUE;
+        return true;
     }
     else if (RB_TYPE_P(x, T_RATIONAL)) {
-        return TRUE;
+        return true;
     }
     else if (RB_TYPE_P(x, T_COMPLEX)) {
         return nucomp_real_p(x);
@@ -1096,11 +1096,11 @@ nucomp_eqeq_p(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/complex.c#L1096
     return f_boolcast(f_eqeq_p(other, self));
 }
 
-static VALUE
+static bool
 nucomp_real_p(VALUE self)
 {
     get_dat1(self);
-    return(f_zero_p(dat->imag) ? Qtrue : Qfalse);
+    return(f_zero_p(dat->imag) ? true : false);
 }
 
 /*
diff --git a/hash.c b/hash.c
index 84ab343..e11afb0 100644
--- a/hash.c
+++ b/hash.c
@@ -4719,7 +4719,7 @@ env_delete(VALUE name) https://github.com/ruby/ruby/blob/trunk/hash.c#L4719
 	    RB_GC_GUARD(name);
 	}
 	else if (ENVMATCH(nam, TZ_ENV)) {
-	    ruby_tz_uptodate_p = FALSE;
+	    ruby_tz_uptodate_p = false;
 	}
 	return value;
     }
diff --git a/time.c b/time.c
index 90bd9ac..3cb5a06 100644
--- a/time.c
+++ b/time.c
@@ -680,7 +680,7 @@ rb_localtime_r(const time_t *t, struct tm *result) https://github.com/ruby/ruby/blob/trunk/time.c#L680
     if (*t != (time_t)(int)*t) return NULL;
 #endif
     if (!ruby_tz_uptodate_p) {
-	ruby_tz_uptodate_p = TRUE;
+	ruby_tz_uptodate_p = true;
 	tzset();
     }
 #ifdef HAVE_GMTIME_R
diff --git a/variable.c b/variable.c
index 4fdffcb..4657352 100644
--- a/variable.c
+++ b/variable.c
@@ -2614,7 +2614,7 @@ rb_const_list(void *data) https://github.com/ruby/ruby/blob/trunk/variable.c#L2614
 VALUE
 rb_mod_constants(int argc, const VALUE *argv, VALUE mod)
 {
-    bool inherit = TRUE;
+    bool inherit = true;
 
     if (rb_check_arity(argc, 0, 1)) inherit = RTEST(argv[0]);
 
@@ -3213,7 +3213,7 @@ cvar_list(void *data) https://github.com/ruby/ruby/blob/trunk/variable.c#L3213
 VALUE
 rb_mod_class_variables(int argc, const VALUE *argv, VALUE mod)
 {
-    bool inherit = TRUE;
+    bool inherit = true;
     st_table *tbl;
 
     if (rb_check_arity(argc, 0, 1)) inherit = RTEST(argv[0]);
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 9078903..a992828 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -889,7 +889,7 @@ vm_get_iclass(rb_control_frame_t *cfp, VALUE klass) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L889
 }
 
 static inline VALUE
-vm_get_ev_const(rb_execution_context_t *ec, VALUE orig_klass, ID id, int allow_nil, int is_defined)
+vm_get_ev_const(rb_execution_context_t *ec, VALUE orig_klass, ID id, bool allow_nil, int is_defined)
 {
     void rb_const_warn_if_deprecated(const rb_const_entry_t *ce, VALUE klass, ID id);
     VALUE val;
-- 
cgit v0.10.2


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

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