From 7256e38f867d88818d33a63f6704a02936929083 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 8 Feb 2024 09:42:16 -0500 Subject: Replace assert with RUBY_ASSERT in complex.c assert does not print the bug report, only the file and line number of the assertion that failed. RUBY_ASSERT prints the full bug report, which makes it much easier to debug. --- complex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'complex.c') diff --git a/complex.c b/complex.c index dc12ac8b1b..c550c2a57b 100644 --- a/complex.c +++ b/complex.c @@ -411,15 +411,15 @@ nucomp_s_alloc(VALUE klass) inline static VALUE f_complex_new_bang1(VALUE klass, VALUE x) { - assert(!RB_TYPE_P(x, T_COMPLEX)); + RUBY_ASSERT(!RB_TYPE_P(x, T_COMPLEX)); return nucomp_s_new_internal(klass, x, ZERO); } inline static VALUE f_complex_new_bang2(VALUE klass, VALUE x, VALUE y) { - assert(!RB_TYPE_P(x, T_COMPLEX)); - assert(!RB_TYPE_P(y, T_COMPLEX)); + RUBY_ASSERT(!RB_TYPE_P(x, T_COMPLEX)); + RUBY_ASSERT(!RB_TYPE_P(y, T_COMPLEX)); return nucomp_s_new_internal(klass, x, y); } @@ -432,7 +432,7 @@ nucomp_real_check(VALUE num) !RB_TYPE_P(num, T_RATIONAL)) { if (RB_TYPE_P(num, T_COMPLEX) && nucomp_real_p(num)) { VALUE real = RCOMPLEX(num)->real; - assert(!RB_TYPE_P(real, T_COMPLEX)); + RUBY_ASSERT(!RB_TYPE_P(real, T_COMPLEX)); return real; } if (!k_numeric_p(num) || !f_real_p(num)) -- cgit v1.2.3