summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-07-14 15:17:35 +0900
committergit <svn-admin@ruby-lang.org>2022-07-14 21:02:02 +0900
commit673759328ca2ff46cc37989dd81c59fe3518e426 (patch)
treef8742a924473635f90b27497afe980f4d4abd699
parent8b64e8f2ed5833570bd1f46683d2b96c7c98413a (diff)
[ruby/bigdecimal] Remove checks for `struct RRational` and `struct RComplex`
These are used to see only if `RRATIONAL` and `RCOMPLEX` are available, however, these two are macros and can be checked with `#ifdef` directly. https://github.com/ruby/bigdecimal/commit/175bbacd43
-rw-r--r--ext/bigdecimal/extconf.rb2
-rw-r--r--ext/bigdecimal/missing.h8
2 files changed, 4 insertions, 6 deletions
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
index 9b0c55b21c..4920374b1a 100644
--- a/ext/bigdecimal/extconf.rb
+++ b/ext/bigdecimal/extconf.rb
@@ -67,10 +67,8 @@ have_header("ruby/atomic.h")
have_header("ruby/internal/has/builtin.h")
have_header("ruby/internal/static_assert.h")
-have_type("struct RRational", "ruby.h")
have_func("rb_rational_num", "ruby.h")
have_func("rb_rational_den", "ruby.h")
-have_type("struct RComplex", "ruby.h")
have_func("rb_complex_real", "ruby.h")
have_func("rb_complex_imag", "ruby.h")
have_func("rb_array_const_ptr", "ruby.h")
diff --git a/ext/bigdecimal/missing.h b/ext/bigdecimal/missing.h
index 7969849158..49b7c7667f 100644
--- a/ext/bigdecimal/missing.h
+++ b/ext/bigdecimal/missing.h
@@ -126,7 +126,7 @@ char *BigDecimal_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, c
static inline VALUE
rb_rational_num(VALUE rat)
{
-#ifdef HAVE_TYPE_STRUCT_RRATIONAL
+#ifdef RRATIONAL
return RRATIONAL(rat)->num;
#else
return rb_funcall(rat, rb_intern("numerator"), 0);
@@ -138,7 +138,7 @@ rb_rational_num(VALUE rat)
static inline VALUE
rb_rational_den(VALUE rat)
{
-#ifdef HAVE_TYPE_STRUCT_RRATIONAL
+#ifdef RRATIONAL
return RRATIONAL(rat)->den;
#else
return rb_funcall(rat, rb_intern("denominator"), 0);
@@ -152,7 +152,7 @@ rb_rational_den(VALUE rat)
static inline VALUE
rb_complex_real(VALUE cmp)
{
-#ifdef HAVE_TYPE_STRUCT_RCOMPLEX
+#ifdef RCOMPLEX
return RCOMPLEX(cmp)->real;
#else
return rb_funcall(cmp, rb_intern("real"), 0);
@@ -164,7 +164,7 @@ rb_complex_real(VALUE cmp)
static inline VALUE
rb_complex_imag(VALUE cmp)
{
-# ifdef HAVE_TYPE_STRUCT_RCOMPLEX
+# ifdef RCOMPLEX
return RCOMPLEX(cmp)->imag;
# else
return rb_funcall(cmp, rb_intern("imag"), 0);