Skip to content

Commit

Permalink
Don't assume that Qfalse is 0 in 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 can directly
return the value and we shouldn't assume that Qfalse is 0.
  • Loading branch information
peterzhu2118 authored and eregon committed Feb 27, 2024
1 parent 3a510bb commit 408e230
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions optional/capi/ext/object_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,7 @@ static VALUE object_spec_rb_method_boundp(VALUE self, VALUE obj, VALUE method, V
}

static VALUE object_spec_rb_special_const_p(VALUE self, VALUE value) {
if (rb_special_const_p(value)) {
return Qtrue;
} else {
return Qfalse;
}
return rb_special_const_p(value);
}

static VALUE so_to_id(VALUE self, VALUE obj) {
Expand Down

0 comments on commit 408e230

Please sign in to comment.