summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-02-08 09:42:16 -0500
committerPeter Zhu <[email protected]>2024-02-12 15:07:47 -0500
commit7256e38f867d88818d33a63f6704a02936929083 (patch)
tree465d6200dc62bc6aa0698e32fbecddf0632d42e8 /complex.c
parentde7a29ef8d72f24d0a6612e3254a014a92aaa1ab (diff)
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.
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c8
1 files changed, 4 insertions, 4 deletions
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))