1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Improve consistency of bool/true/false

This commit is contained in:
Kazuhiro NISHIYAMA 2019-11-25 15:05:53 +09:00
parent e27acb6148
commit 09e76e9828
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A
5 changed files with 11 additions and 11 deletions

View file

@ -235,19 +235,19 @@ f_negate(VALUE x)
return rb_funcall(x, id_negate, 0); return rb_funcall(x, id_negate, 0);
} }
static VALUE nucomp_real_p(VALUE self); static bool nucomp_real_p(VALUE self);
static inline bool static inline bool
f_real_p(VALUE x) f_real_p(VALUE x)
{ {
if (RB_INTEGER_TYPE_P(x)) { if (RB_INTEGER_TYPE_P(x)) {
return TRUE; return true;
} }
else if (RB_FLOAT_TYPE_P(x)) { else if (RB_FLOAT_TYPE_P(x)) {
return TRUE; return true;
} }
else if (RB_TYPE_P(x, T_RATIONAL)) { else if (RB_TYPE_P(x, T_RATIONAL)) {
return TRUE; return true;
} }
else if (RB_TYPE_P(x, T_COMPLEX)) { else if (RB_TYPE_P(x, T_COMPLEX)) {
return nucomp_real_p(x); return nucomp_real_p(x);
@ -1096,11 +1096,11 @@ nucomp_eqeq_p(VALUE self, VALUE other)
return f_boolcast(f_eqeq_p(other, self)); return f_boolcast(f_eqeq_p(other, self));
} }
static VALUE static bool
nucomp_real_p(VALUE self) nucomp_real_p(VALUE self)
{ {
get_dat1(self); get_dat1(self);
return(f_zero_p(dat->imag) ? Qtrue : Qfalse); return(f_zero_p(dat->imag) ? true : false);
} }
/* /*

2
hash.c
View file

@ -4719,7 +4719,7 @@ env_delete(VALUE name)
RB_GC_GUARD(name); RB_GC_GUARD(name);
} }
else if (ENVMATCH(nam, TZ_ENV)) { else if (ENVMATCH(nam, TZ_ENV)) {
ruby_tz_uptodate_p = FALSE; ruby_tz_uptodate_p = false;
} }
return value; return value;
} }

2
time.c
View file

@ -680,7 +680,7 @@ rb_localtime_r(const time_t *t, struct tm *result)
if (*t != (time_t)(int)*t) return NULL; if (*t != (time_t)(int)*t) return NULL;
#endif #endif
if (!ruby_tz_uptodate_p) { if (!ruby_tz_uptodate_p) {
ruby_tz_uptodate_p = TRUE; ruby_tz_uptodate_p = true;
tzset(); tzset();
} }
#ifdef HAVE_GMTIME_R #ifdef HAVE_GMTIME_R

View file

@ -2614,7 +2614,7 @@ rb_const_list(void *data)
VALUE VALUE
rb_mod_constants(int argc, const VALUE *argv, VALUE mod) 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]); if (rb_check_arity(argc, 0, 1)) inherit = RTEST(argv[0]);
@ -3213,7 +3213,7 @@ cvar_list(void *data)
VALUE VALUE
rb_mod_class_variables(int argc, const VALUE *argv, VALUE mod) rb_mod_class_variables(int argc, const VALUE *argv, VALUE mod)
{ {
bool inherit = TRUE; bool inherit = true;
st_table *tbl; st_table *tbl;
if (rb_check_arity(argc, 0, 1)) inherit = RTEST(argv[0]); if (rb_check_arity(argc, 0, 1)) inherit = RTEST(argv[0]);

View file

@ -889,7 +889,7 @@ vm_get_iclass(rb_control_frame_t *cfp, VALUE klass)
} }
static inline VALUE 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); void rb_const_warn_if_deprecated(const rb_const_entry_t *ce, VALUE klass, ID id);
VALUE val; VALUE val;