mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Negative RBOOL usage
This commit is contained in:
parent
77ee47188e
commit
069cca6f74
Notes:
git
2022-01-01 18:54:15 +09:00
9 changed files with 14 additions and 14 deletions
2
cont.c
2
cont.c
|
@ -2483,7 +2483,7 @@ rb_fiber_reset_root_local_storage(rb_thread_t *th)
|
|||
VALUE
|
||||
rb_fiber_alive_p(VALUE fiber_value)
|
||||
{
|
||||
return FIBER_TERMINATED_P(fiber_ptr(fiber_value)) ? Qfalse : Qtrue;
|
||||
return RBOOL(!FIBER_TERMINATED_P(fiber_ptr(fiber_value)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
2
dir.c
2
dir.c
|
@ -3323,7 +3323,7 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname)
|
|||
al.dirattr = ATTR_DIR_ENTRYCOUNT;
|
||||
if (getattrlist(path, &al, attrbuf, sizeof(attrbuf), 0) == 0) {
|
||||
if (attrbuf[0] >= 2 * sizeof(u_int32_t))
|
||||
return attrbuf[1] ? Qfalse : Qtrue;
|
||||
return RBOOL(attrbuf[1] == 0);
|
||||
if (false_on_notdir) return Qfalse;
|
||||
}
|
||||
rb_sys_fail_path(orig);
|
||||
|
|
4
gc.c
4
gc.c
|
@ -8600,7 +8600,7 @@ rb_copy_wb_protected_attribute(VALUE dest, VALUE obj)
|
|||
VALUE
|
||||
rb_obj_rgengc_writebarrier_protected_p(VALUE obj)
|
||||
{
|
||||
return RVALUE_WB_UNPROTECTED(obj) ? Qfalse : Qtrue;
|
||||
return RBOOL(!RVALUE_WB_UNPROTECTED(obj));
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -12343,7 +12343,7 @@ wmap_aref(VALUE self, VALUE key)
|
|||
static VALUE
|
||||
wmap_has_key(VALUE self, VALUE key)
|
||||
{
|
||||
return wmap_lookup(self, key) == Qundef ? Qfalse : Qtrue;
|
||||
return RBOOL(wmap_lookup(self, key) != Qundef);
|
||||
}
|
||||
|
||||
/* Returns the number of referenced objects */
|
||||
|
|
2
io.c
2
io.c
|
@ -8933,7 +8933,7 @@ rb_io_autoclose_p(VALUE io)
|
|||
{
|
||||
rb_io_t *fptr = RFILE(io)->fptr;
|
||||
rb_io_check_closed(fptr);
|
||||
return (fptr->mode & FMODE_PREP) ? Qfalse : Qtrue;
|
||||
return RBOOL(!(fptr->mode & FMODE_PREP));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -3657,7 +3657,7 @@ static VALUE
|
|||
int_anybits_p(VALUE num, VALUE mask)
|
||||
{
|
||||
mask = rb_to_int(mask);
|
||||
return int_zero_p(rb_int_and(num, mask)) ? Qfalse : Qtrue;
|
||||
return RBOOL(!int_zero_p(rb_int_and(num, mask)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
8
object.c
8
object.c
|
@ -204,7 +204,7 @@ VALUE rb_obj_hash(VALUE obj);
|
|||
MJIT_FUNC_EXPORTED VALUE
|
||||
rb_obj_not(VALUE obj)
|
||||
{
|
||||
return RTEST(obj) ? Qfalse : Qtrue;
|
||||
return RBOOL(!RTEST(obj));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -221,7 +221,7 @@ MJIT_FUNC_EXPORTED VALUE
|
|||
rb_obj_not_equal(VALUE obj1, VALUE obj2)
|
||||
{
|
||||
VALUE result = rb_funcall(obj1, id_eq, 1, obj2);
|
||||
return RTEST(result) ? Qfalse : Qtrue;
|
||||
return rb_obj_not(result);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -1295,7 +1295,7 @@ true_or(VALUE obj, VALUE obj2)
|
|||
static VALUE
|
||||
true_xor(VALUE obj, VALUE obj2)
|
||||
{
|
||||
return RTEST(obj2)?Qfalse:Qtrue;
|
||||
return rb_obj_not(obj2);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1426,7 +1426,7 @@ static VALUE
|
|||
rb_obj_not_match(VALUE obj1, VALUE obj2)
|
||||
{
|
||||
VALUE result = rb_funcall(obj1, id_match, 1, obj2);
|
||||
return RTEST(result) ? Qfalse : Qtrue;
|
||||
return rb_obj_not(result);
|
||||
}
|
||||
|
||||
|
||||
|
|
2
proc.c
2
proc.c
|
@ -1604,7 +1604,7 @@ respond_to_missing_p(VALUE klass, VALUE obj, VALUE sym, int scope)
|
|||
|
||||
if (obj == Qundef) return 0;
|
||||
if (rb_method_basic_definition_p(klass, rmiss)) return 0;
|
||||
return RTEST(rb_funcall(obj, rmiss, 2, sym, scope ? Qfalse : Qtrue));
|
||||
return RTEST(rb_funcall(obj, rmiss, 2, sym, RBOOL(!scope)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5205,7 +5205,7 @@ vm_opt_neq(const rb_iseq_t *iseq, CALL_DATA cd, CALL_DATA cd_eq, VALUE recv, VAL
|
|||
VALUE val = opt_equality(iseq, recv, obj, cd_eq);
|
||||
|
||||
if (val != Qundef) {
|
||||
return RTEST(val) ? Qfalse : Qtrue;
|
||||
return RBOOL(!RTEST(val));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5538,7 +5538,7 @@ static VALUE
|
|||
vm_opt_not(const rb_iseq_t *iseq, CALL_DATA cd, VALUE recv)
|
||||
{
|
||||
if (vm_method_cfunc_is(iseq, cd, recv, rb_obj_not)) {
|
||||
return RTEST(recv) ? Qfalse : Qtrue;
|
||||
return RBOOL(!RTEST(recv));
|
||||
}
|
||||
else {
|
||||
return Qundef;
|
||||
|
|
|
@ -2678,7 +2678,7 @@ basic_obj_respond_to(rb_execution_context_t *ec, VALUE obj, ID id, int pub)
|
|||
return FALSE;
|
||||
case 0:
|
||||
ret = basic_obj_respond_to_missing(ec, klass, obj, ID2SYM(id),
|
||||
pub ? Qfalse : Qtrue);
|
||||
RBOOL(!pub));
|
||||
return RTEST(ret) && ret != Qundef;
|
||||
default:
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in a new issue