ruby-changes:72547
From: Nobuyoshi <ko1@a...>
Date: Thu, 14 Jul 2022 21:02:17 +0900 (JST)
Subject: [ruby-changes:72547] 673759328c (master): [ruby/bigdecimal] Remove checks for `struct RRational` and `struct RComplex`
https://git.ruby-lang.org/ruby.git/commit/?id=673759328c From 673759328ca2ff46cc37989dd81c59fe3518e426 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 14 Jul 2022 15:17:35 +0900 Subject: [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 --- ext/bigdecimal/extconf.rb | 2 -- ext/bigdecimal/missing.h | 8 ++++---- 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") https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/extconf.rb#L67 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 https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/missing.h#L126 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) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/missing.h#L138 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) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/missing.h#L152 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) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/missing.h#L164 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); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/