Skip to content

Commit 408e230

Browse files
peterzhu2118eregon
authored andcommitted
Don't assume that Qfalse is 0 in rb_special_const_p
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.
1 parent 3a510bb commit 408e230

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

optional/capi/ext/object_spec.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,7 @@ static VALUE object_spec_rb_method_boundp(VALUE self, VALUE obj, VALUE method, V
179179
}
180180

181181
static VALUE object_spec_rb_special_const_p(VALUE self, VALUE value) {
182-
if (rb_special_const_p(value)) {
183-
return Qtrue;
184-
} else {
185-
return Qfalse;
186-
}
182+
return rb_special_const_p(value);
187183
}
188184

189185
static VALUE so_to_id(VALUE self, VALUE obj) {

0 commit comments

Comments
 (0)