Replace assert with RUBY_ASSERT in enum.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.
This commit is contained in:
parent
11ffee88b5
commit
436191abe0
8
enum.c
8
enum.c
@ -4538,7 +4538,7 @@ struct enum_sum_memo {
|
|||||||
static void
|
static void
|
||||||
sum_iter_normalize_memo(struct enum_sum_memo *memo)
|
sum_iter_normalize_memo(struct enum_sum_memo *memo)
|
||||||
{
|
{
|
||||||
assert(FIXABLE(memo->n));
|
RUBY_ASSERT(FIXABLE(memo->n));
|
||||||
memo->v = rb_fix_plus(LONG2FIX(memo->n), memo->v);
|
memo->v = rb_fix_plus(LONG2FIX(memo->n), memo->v);
|
||||||
memo->n = 0;
|
memo->n = 0;
|
||||||
|
|
||||||
@ -4640,7 +4640,7 @@ sum_iter_Kahan_Babuska(VALUE i, struct enum_sum_memo *memo)
|
|||||||
static void
|
static void
|
||||||
sum_iter(VALUE i, struct enum_sum_memo *memo)
|
sum_iter(VALUE i, struct enum_sum_memo *memo)
|
||||||
{
|
{
|
||||||
assert(memo != NULL);
|
RUBY_ASSERT(memo != NULL);
|
||||||
if (memo->block_given) {
|
if (memo->block_given) {
|
||||||
i = rb_yield(i);
|
i = rb_yield(i);
|
||||||
}
|
}
|
||||||
@ -4691,8 +4691,8 @@ hash_sum_i(VALUE key, VALUE value, VALUE arg)
|
|||||||
static void
|
static void
|
||||||
hash_sum(VALUE hash, struct enum_sum_memo *memo)
|
hash_sum(VALUE hash, struct enum_sum_memo *memo)
|
||||||
{
|
{
|
||||||
assert(RB_TYPE_P(hash, T_HASH));
|
RUBY_ASSERT(RB_TYPE_P(hash, T_HASH));
|
||||||
assert(memo != NULL);
|
RUBY_ASSERT(memo != NULL);
|
||||||
|
|
||||||
rb_hash_foreach(hash, hash_sum_i, (VALUE)memo);
|
rb_hash_foreach(hash, hash_sum_i, (VALUE)memo);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user