Skip to content

Commit

Permalink
Use RB_SPECIAL_CONST_P instead of rb_special_const_p
Browse files Browse the repository at this point in the history
rb_special_const_p returns a VALUE (Qtrue or Qfalse), so we shouldn't
assume that Qfalse is 0. We should instead use RB_SPECIAL_CONST_P.
  • Loading branch information
peterzhu2118 committed Feb 28, 2024
1 parent 95e55e9 commit e8e2415
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gc.c
Expand Up @@ -4398,7 +4398,7 @@ is_live_object(rb_objspace_t *objspace, VALUE ptr)
static inline int
is_markable_object(VALUE obj)
{
if (rb_special_const_p(obj)) return FALSE; /* special const is not markable */
if (RB_SPECIAL_CONST_P(obj)) return FALSE; /* special const is not markable */
check_rvalue_consistency(obj);
return TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion marshal.c
Expand Up @@ -1889,7 +1889,7 @@ r_object_for(struct load_arg *arg, bool partial, int *ivp, VALUE extmod, int typ
goto type_hash;
}
v = r_object_for(arg, partial, 0, extmod, type);
if (rb_special_const_p(v) || RB_TYPE_P(v, T_OBJECT) || RB_TYPE_P(v, T_CLASS)) {
if (RB_SPECIAL_CONST_P(v) || RB_TYPE_P(v, T_OBJECT) || RB_TYPE_P(v, T_CLASS)) {
goto format_error;
}
if (RB_TYPE_P(v, T_MODULE) || !RTEST(rb_class_inherited_p(c, RBASIC(v)->klass))) {
Expand Down
2 changes: 1 addition & 1 deletion vm.c
Expand Up @@ -2922,7 +2922,7 @@ rb_vm_each_stack_value(void *ptr, void (*cb)(VALUE, void*), void *ctx)
VALUE *p = ec->vm_stack;
VALUE *sp = ec->cfp->sp;
while (p < sp) {
if (!rb_special_const_p(*p)) {
if (!RB_SPECIAL_CONST_P(*p)) {
cb(*p, ctx);
}
p++;
Expand Down

0 comments on commit e8e2415

Please sign in to comment.