From a2ac82e1d333381905cbd1b9095e427c08c8d7e6 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 27 Feb 2024 15:16:28 -0500 Subject: [PATCH] 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. --- optional/capi/ext/object_spec.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/optional/capi/ext/object_spec.c b/optional/capi/ext/object_spec.c index 7023c29bd..f00e9d190 100644 --- a/optional/capi/ext/object_spec.c +++ b/optional/capi/ext/object_spec.c @@ -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) {