Skip to content

Commit 175bbac

Browse files
nobumrkn
authored andcommitted
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.
1 parent 3ede886 commit 175bbac

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

ext/bigdecimal/extconf.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,8 @@ def have_builtin_func(name, check_expr, opt = "", &b)
6767
have_header("ruby/internal/has/builtin.h")
6868
have_header("ruby/internal/static_assert.h")
6969

70-
have_type("struct RRational", "ruby.h")
7170
have_func("rb_rational_num", "ruby.h")
7271
have_func("rb_rational_den", "ruby.h")
73-
have_type("struct RComplex", "ruby.h")
7472
have_func("rb_complex_real", "ruby.h")
7573
have_func("rb_complex_imag", "ruby.h")
7674
have_func("rb_array_const_ptr", "ruby.h")

ext/bigdecimal/missing.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ char *BigDecimal_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, c
126126
static inline VALUE
127127
rb_rational_num(VALUE rat)
128128
{
129-
#ifdef HAVE_TYPE_STRUCT_RRATIONAL
129+
#ifdef RRATIONAL
130130
return RRATIONAL(rat)->num;
131131
#else
132132
return rb_funcall(rat, rb_intern("numerator"), 0);
@@ -138,7 +138,7 @@ rb_rational_num(VALUE rat)
138138
static inline VALUE
139139
rb_rational_den(VALUE rat)
140140
{
141-
#ifdef HAVE_TYPE_STRUCT_RRATIONAL
141+
#ifdef RRATIONAL
142142
return RRATIONAL(rat)->den;
143143
#else
144144
return rb_funcall(rat, rb_intern("denominator"), 0);
@@ -152,7 +152,7 @@ rb_rational_den(VALUE rat)
152152
static inline VALUE
153153
rb_complex_real(VALUE cmp)
154154
{
155-
#ifdef HAVE_TYPE_STRUCT_RCOMPLEX
155+
#ifdef RCOMPLEX
156156
return RCOMPLEX(cmp)->real;
157157
#else
158158
return rb_funcall(cmp, rb_intern("real"), 0);
@@ -164,7 +164,7 @@ rb_complex_real(VALUE cmp)
164164
static inline VALUE
165165
rb_complex_imag(VALUE cmp)
166166
{
167-
# ifdef HAVE_TYPE_STRUCT_RCOMPLEX
167+
# ifdef RCOMPLEX
168168
return RCOMPLEX(cmp)->imag;
169169
# else
170170
return rb_funcall(cmp, rb_intern("imag"), 0);

0 commit comments

Comments
 (0)