Replace assert with RUBY_ASSERT in id_table.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
436191abe0
commit
ea92374bf7
@ -150,7 +150,7 @@ hash_table_raw_insert(struct rb_id_table *tbl, id_key_t key, VALUE val)
|
|||||||
int mask = tbl->capa - 1;
|
int mask = tbl->capa - 1;
|
||||||
int ix = key & mask;
|
int ix = key & mask;
|
||||||
int d = 1;
|
int d = 1;
|
||||||
assert(key != 0);
|
RUBY_ASSERT(key != 0);
|
||||||
while (ITEM_KEY_ISSET(tbl, ix)) {
|
while (ITEM_KEY_ISSET(tbl, ix)) {
|
||||||
ITEM_SET_COLLIDED(tbl, ix);
|
ITEM_SET_COLLIDED(tbl, ix);
|
||||||
ix = (ix + d) & mask;
|
ix = (ix + d) & mask;
|
||||||
@ -276,7 +276,7 @@ rb_id_table_foreach(struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, v
|
|||||||
if (ITEM_KEY_ISSET(tbl, i)) {
|
if (ITEM_KEY_ISSET(tbl, i)) {
|
||||||
const id_key_t key = ITEM_GET_KEY(tbl, i);
|
const id_key_t key = ITEM_GET_KEY(tbl, i);
|
||||||
enum rb_id_table_iterator_result ret = (*func)(key2id(key), tbl->items[i].val, data);
|
enum rb_id_table_iterator_result ret = (*func)(key2id(key), tbl->items[i].val, data);
|
||||||
assert(key != 0);
|
RUBY_ASSERT(key != 0);
|
||||||
|
|
||||||
if (ret == ID_TABLE_DELETE)
|
if (ret == ID_TABLE_DELETE)
|
||||||
hash_delete_index(tbl, i);
|
hash_delete_index(tbl, i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user