summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ast.c4
-rw-r--r--bignum.c10
-rw-r--r--compile.c4
-rw-r--r--dir.c4
-rw-r--r--enumerator.c2
-rw-r--r--file.c28
-rw-r--r--gc.c8
-rw-r--r--iseq.c2
-rw-r--r--numeric.rb6
-rw-r--r--parse.y8
-rw-r--r--process.c2
-rw-r--r--ractor.rb2
-rw-r--r--ruby.c2
-rw-r--r--time.c2
-rw-r--r--transcode.c2
15 files changed, 43 insertions, 43 deletions
diff --git a/ast.c b/ast.c
index 0b6791d221f..202527f53f5 100644
--- a/ast.c
+++ b/ast.c
@@ -366,7 +366,7 @@ node_children(rb_ast_t *ast, const NODE *node)
case NODE_WHILE:
case NODE_UNTIL:
return rb_ary_push(rb_ary_new_from_node_args(ast, 2, node->nd_cond, node->nd_body),
- (node->nd_state ? Qtrue : Qfalse));
+ RBOOL(node->nd_state));
case NODE_ITER:
case NODE_FOR:
return rb_ary_new_from_node_args(ast, 2, node->nd_iter, node->nd_body);
@@ -433,7 +433,7 @@ node_children(rb_ast_t *ast, const NODE *node)
NEW_CHILD(ast, node->nd_args->nd_body));
case NODE_OP_ASGN2:
return rb_ary_new_from_args(5, NEW_CHILD(ast, node->nd_recv),
- node->nd_next->nd_aid ? Qtrue : Qfalse,
+ RBOOL(node->nd_next->nd_aid),
ID2SYM(node->nd_next->nd_vid),
ID2SYM(node->nd_next->nd_mid),
NEW_CHILD(ast, node->nd_value));
diff --git a/bignum.c b/bignum.c
index 939b33ca454..9e1ded59093 100644
--- a/bignum.c
+++ b/bignum.c
@@ -5471,10 +5471,10 @@ big_op(VALUE x, VALUE y, enum big_op_t op)
n = FIX2INT(rel);
switch (op) {
- case big_op_gt: return n > 0 ? Qtrue : Qfalse;
- case big_op_ge: return n >= 0 ? Qtrue : Qfalse;
- case big_op_lt: return n < 0 ? Qtrue : Qfalse;
- case big_op_le: return n <= 0 ? Qtrue : Qfalse;
+ case big_op_gt: return RBOOL(n > 0);
+ case big_op_ge: return RBOOL(n >= 0);
+ case big_op_lt: return RBOOL(n < 0);
+ case big_op_le: return RBOOL(n <= 0);
}
return Qundef;
}
@@ -5518,7 +5518,7 @@ VALUE
rb_big_eq(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
- return bignorm(x) == y ? Qtrue : Qfalse;
+ return RBOOL(bignorm(x) == y);
}
else if (RB_BIGNUM_TYPE_P(y)) {
}
diff --git a/compile.c b/compile.c
index 90f0d873282..3d1ec62469b 100644
--- a/compile.c
+++ b/compile.c
@@ -1654,7 +1654,7 @@ access_outer_variables(const rb_iseq_t *iseq, int level, ID id, bool write)
}
}
else {
- rb_id_table_insert(iseq->body->outer_variables, id, write ? Qtrue : Qfalse);
+ rb_id_table_insert(iseq->body->outer_variables, id, RBOOL(write));
}
iseq = iseq->body->parent_iseq;
@@ -5496,7 +5496,7 @@ setup_args_core(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn,
switch (nd_type(argn)) {
case NODE_SPLAT: {
NO_CHECK(COMPILE(args, "args (splat)", argn->nd_head));
- ADD_INSN1(args, argn, splatarray, dup_rest ? Qtrue : Qfalse);
+ ADD_INSN1(args, argn, splatarray, RBOOL(dup_rest));
if (flag) *flag |= VM_CALL_ARGS_SPLAT;
return INT2FIX(1);
}
diff --git a/dir.c b/dir.c
index 8ac10d23601..32bce9f2b65 100644
--- a/dir.c
+++ b/dir.c
@@ -1429,7 +1429,7 @@ with_gvl_gc_for_fd(void *ptr)
{
int *e = ptr;
- return (void *)(rb_gc_for_fd(*e) ? Qtrue : Qfalse);
+ return (void *)RBOOL(rb_gc_for_fd(*e));
}
static int
@@ -1438,7 +1438,7 @@ gc_for_fd_with_gvl(int e)
if (vm_initialized)
return (int)(VALUE)rb_thread_call_with_gvl(with_gvl_gc_for_fd, &e);
else
- return rb_gc_for_fd(e) ? Qtrue : Qfalse;
+ return RBOOL(rb_gc_for_fd(e));
}
static void *
diff --git a/enumerator.c b/enumerator.c
index 9c91e999b8b..3ada2b09578 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -3369,7 +3369,7 @@ rb_arith_seq_new(VALUE obj, VALUE meth, int argc, VALUE const *argv,
rb_ivar_set(aseq, id_begin, beg);
rb_ivar_set(aseq, id_end, end);
rb_ivar_set(aseq, id_step, step);
- rb_ivar_set(aseq, id_exclude_end, excl ? Qtrue : Qfalse);
+ rb_ivar_set(aseq, id_exclude_end, RBOOL(excl));
return aseq;
}
diff --git a/file.c b/file.c
index eb10c54c34d..f5d01fda2a0 100644
--- a/file.c
+++ b/file.c
@@ -5794,11 +5794,11 @@ rb_stat_r(VALUE obj)
#endif
#ifdef S_IRUSR
if (rb_stat_owned(obj))
- return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IRUSR);
#endif
#ifdef S_IRGRP
if (rb_stat_grpowned(obj))
- return st->st_mode & S_IRGRP ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IRGRP);
#endif
#ifdef S_IROTH
if (!(st->st_mode & S_IROTH)) return Qfalse;
@@ -5827,11 +5827,11 @@ rb_stat_R(VALUE obj)
#endif
#ifdef S_IRUSR
if (rb_stat_rowned(obj))
- return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IRUSR);
#endif
#ifdef S_IRGRP
if (rb_group_member(get_stat(obj)->st_gid))
- return st->st_mode & S_IRGRP ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IRGRP);
#endif
#ifdef S_IROTH
if (!(st->st_mode & S_IROTH)) return Qfalse;
@@ -5887,11 +5887,11 @@ rb_stat_w(VALUE obj)
#endif
#ifdef S_IWUSR
if (rb_stat_owned(obj))
- return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IWUSR);
#endif
#ifdef S_IWGRP
if (rb_stat_grpowned(obj))
- return st->st_mode & S_IWGRP ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IWGRP);
#endif
#ifdef S_IWOTH
if (!(st->st_mode & S_IWOTH)) return Qfalse;
@@ -5920,11 +5920,11 @@ rb_stat_W(VALUE obj)
#endif
#ifdef S_IWUSR
if (rb_stat_rowned(obj))
- return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IWUSR);
#endif
#ifdef S_IWGRP
if (rb_group_member(get_stat(obj)->st_gid))
- return st->st_mode & S_IWGRP ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IWGRP);
#endif
#ifdef S_IWOTH
if (!(st->st_mode & S_IWOTH)) return Qfalse;
@@ -5979,16 +5979,16 @@ rb_stat_x(VALUE obj)
#ifdef USE_GETEUID
if (geteuid() == 0) {
- return st->st_mode & S_IXUGO ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IXUGO);
}
#endif
#ifdef S_IXUSR
if (rb_stat_owned(obj))
- return st->st_mode & S_IXUSR ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IXUSR);
#endif
#ifdef S_IXGRP
if (rb_stat_grpowned(obj))
- return st->st_mode & S_IXGRP ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IXGRP);
#endif
#ifdef S_IXOTH
if (!(st->st_mode & S_IXOTH)) return Qfalse;
@@ -6011,16 +6011,16 @@ rb_stat_X(VALUE obj)
#ifdef USE_GETEUID
if (getuid() == 0) {
- return st->st_mode & S_IXUGO ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IXUGO);
}
#endif
#ifdef S_IXUSR
if (rb_stat_rowned(obj))
- return st->st_mode & S_IXUSR ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IXUSR);
#endif
#ifdef S_IXGRP
if (rb_group_member(get_stat(obj)->st_gid))
- return st->st_mode & S_IXGRP ? Qtrue : Qfalse;
+ return RBOOL(st->st_mode & S_IXGRP);
#endif
#ifdef S_IXOTH
if (!(st->st_mode & S_IXOTH)) return Qfalse;
diff --git a/gc.c b/gc.c
index 2b57241f607..bae2bdd6189 100644
--- a/gc.c
+++ b/gc.c
@@ -10445,8 +10445,8 @@ gc_info_decode(rb_objspace_t *objspace, const VALUE hash_or_key, const unsigned
Qnil
);
- SET(have_finalizer, (flags & GPR_FLAG_HAVE_FINALIZE) ? Qtrue : Qfalse);
- SET(immediate_sweep, (flags & GPR_FLAG_IMMEDIATE_SWEEP) ? Qtrue : Qfalse);
+ SET(have_finalizer, RBOOL(flags & GPR_FLAG_HAVE_FINALIZE));
+ SET(immediate_sweep, RBOOL(flags & GPR_FLAG_IMMEDIATE_SWEEP));
if (orig_flags == 0) {
SET(state, gc_mode(objspace) == gc_mode_none ? sym_none :
@@ -12732,7 +12732,7 @@ gc_profile_record_get(VALUE _)
rb_hash_aset(prof, ID2SYM(rb_intern("REMOVING_OBJECTS")), SIZET2NUM(record->removing_objects));
rb_hash_aset(prof, ID2SYM(rb_intern("EMPTY_OBJECTS")), SIZET2NUM(record->empty_objects));
- rb_hash_aset(prof, ID2SYM(rb_intern("HAVE_FINALIZE")), (record->flags & GPR_FLAG_HAVE_FINALIZE) ? Qtrue : Qfalse);
+ rb_hash_aset(prof, ID2SYM(rb_intern("HAVE_FINALIZE")), RBOOL(record->flags & GPR_FLAG_HAVE_FINALIZE));
#endif
#if RGENGC_PROFILE > 0
@@ -13553,7 +13553,7 @@ Init_GC(void)
rb_mGC = rb_define_module("GC");
gc_constants = rb_hash_new();
- rb_hash_aset(gc_constants, ID2SYM(rb_intern("DEBUG")), GC_DEBUG ? Qtrue : Qfalse);
+ rb_hash_aset(gc_constants, ID2SYM(rb_intern("DEBUG")), RBOOL(GC_DEBUG));
rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVALUE_SIZE")), SIZET2NUM(sizeof(RVALUE)));
rb_hash_aset(gc_constants, ID2SYM(rb_intern("HEAP_PAGE_OBJ_LIMIT")), SIZET2NUM(HEAP_PAGE_OBJ_LIMIT));
rb_hash_aset(gc_constants, ID2SYM(rb_intern("HEAP_PAGE_BITMAP_SIZE")), SIZET2NUM(HEAP_PAGE_BITMAP_SIZE));
diff --git a/iseq.c b/iseq.c
index 3dd7beaf0d0..d3bd4a22f3e 100644
--- a/iseq.c
+++ b/iseq.c
@@ -784,7 +784,7 @@ make_compile_option_value(rb_compile_option_t *option)
{
VALUE opt = rb_hash_new_with_size(11);
#define SET_COMPILE_OPTION(o, h, mem) \
- rb_hash_aset((h), ID2SYM(rb_intern(#mem)), (o)->mem ? Qtrue : Qfalse)
+ rb_hash_aset((h), ID2SYM(rb_intern(#mem)), RBOOL((o)->mem))
#define SET_COMPILE_OPTION_NUM(o, h, mem) \
rb_hash_aset((h), ID2SYM(rb_intern(#mem)), INT2NUM((o)->mem))
{
diff --git a/numeric.rb b/numeric.rb
index 1f86ba2e1be..b9e8dd5fabd 100644
--- a/numeric.rb
+++ b/numeric.rb
@@ -282,7 +282,7 @@ class Float
#
def zero?
Primitive.attr! 'inline'
- Primitive.cexpr! 'FLOAT_ZERO_P(self) ? Qtrue : Qfalse'
+ Primitive.cexpr! 'RBOOL(FLOAT_ZERO_P(self))'
end
#
@@ -293,7 +293,7 @@ class Float
#
def positive?
Primitive.attr! 'inline'
- Primitive.cexpr! 'RFLOAT_VALUE(self) > 0.0 ? Qtrue : Qfalse'
+ Primitive.cexpr! 'RBOOL(RFLOAT_VALUE(self) > 0.0)'
end
#
@@ -304,6 +304,6 @@ class Float
#
def negative?
Primitive.attr! 'inline'
- Primitive.cexpr! 'RFLOAT_VALUE(self) < 0.0 ? Qtrue : Qfalse'
+ Primitive.cexpr! 'RBOOL(RFLOAT_VALUE(self) < 0.0)'
end
end
diff --git a/parse.y b/parse.y
index 2873d2fff3b..8017011bb79 100644
--- a/parse.y
+++ b/parse.y
@@ -8108,7 +8108,7 @@ parser_set_compile_option_flag(struct parser_params *p, const char *name, const
if (!p->compile_option)
p->compile_option = rb_obj_hide(rb_ident_hash_new());
rb_hash_aset(p->compile_option, ID2SYM(rb_intern(name)),
- (b ? Qtrue : Qfalse));
+ RBOOL(b));
}
static void
@@ -13231,7 +13231,7 @@ ripper_error_p(VALUE vparser)
struct parser_params *p;
TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, p);
- return p->error_p ? Qtrue : Qfalse;
+ return RBOOL(p->error_p);
}
#endif
@@ -13247,7 +13247,7 @@ rb_parser_end_seen_p(VALUE vparser)
struct parser_params *p;
TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, p);
- return p->ruby__end__seen ? Qtrue : Qfalse;
+ return RBOOL(p->ruby__end__seen);
}
/*
@@ -13278,7 +13278,7 @@ rb_parser_get_yydebug(VALUE self)
struct parser_params *p;
TypedData_Get_Struct(self, struct parser_params, &parser_data_type, p);
- return p->debug ? Qtrue : Qfalse;
+ return RBOOL(p->debug);
}
#endif
diff --git a/process.c b/process.c
index 3193725710e..8c0f11259be 100644
--- a/process.c
+++ b/process.c
@@ -1025,7 +1025,7 @@ pst_success_p(VALUE st)
if (!WIFEXITED(status))
return Qnil;
- return WEXITSTATUS(status) == EXIT_SUCCESS ? Qtrue : Qfalse;
+ return RBOOL(WEXITSTATUS(status) == EXIT_SUCCESS);
}
diff --git a/ractor.rb b/ractor.rb
index de7c9a93a74..1b8cd118fb3 100644
--- a/ractor.rb
+++ b/ractor.rb
@@ -768,7 +768,7 @@ class Ractor
# See also the "Shareable and unshareable objects" section in the Ractor class docs.
def self.shareable? obj
__builtin_cexpr! %q{
- rb_ractor_shareable_p(obj) ? Qtrue : Qfalse;
+ RBOOL(rb_ractor_shareable_p(obj));
}
end
diff --git a/ruby.c b/ruby.c
index a845a812d94..54e788a9ec7 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1926,7 +1926,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
VALUE option = rb_hash_new();
#define SET_COMPILE_OPTION(h, o, name) \
rb_hash_aset((h), ID2SYM(rb_intern_const(#name)), \
- (FEATURE_SET_P(o->features, FEATURE_BIT(name)) ? Qtrue : Qfalse));
+ RBOOL(FEATURE_SET_P(o->features, FEATURE_BIT(name))));
SET_COMPILE_OPTION(option, opt, frozen_string_literal);
SET_COMPILE_OPTION(option, opt, debug_frozen_string_literal);
rb_funcallv(rb_cISeq, rb_intern_const("compile_option="), 1, &option);
diff --git a/time.c b/time.c
index 58e20304ed6..fb2f671fe0a 100644
--- a/time.c
+++ b/time.c
@@ -4460,7 +4460,7 @@ time_wday(VALUE time)
}
#define wday_p(n) {\
- return (time_wday(time) == INT2FIX(n)) ? Qtrue : Qfalse; \
+ return RBOOL(time_wday(time) == INT2FIX(n)); \
}
/*
diff --git a/transcode.c b/transcode.c
index e4ff32653e8..c61698eca14 100644
--- a/transcode.c
+++ b/transcode.c
@@ -2079,7 +2079,7 @@ make_econv_exception(rb_econv_t *ec)
exc = rb_exc_new3(rb_eInvalidByteSequenceError, mesg);
rb_ivar_set(exc, id_error_bytes, bytes);
rb_ivar_set(exc, id_readagain_bytes, bytes2);
- rb_ivar_set(exc, id_incomplete_input, ec->last_error.result == econv_incomplete_input ? Qtrue : Qfalse);
+ rb_ivar_set(exc, id_incomplete_input, RBOOL(ec->last_error.result == econv_incomplete_input));
goto set_encs;
}
if (ec->last_error.result == econv_undefined_conversion) {