From 142d5db1122cf28f1a5563c421f169923a9f2e79 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 25 Jan 2022 16:16:37 -0500 Subject: [PATCH] Support ID_TABLE_STOP for replace function Iteration should top if the replace function returns ID_TABLE_STOP. --- id_table.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/id_table.c b/id_table.c index 6cf4af9c5f..a1b09ba0ed 100644 --- a/id_table.c +++ b/id_table.c @@ -317,7 +317,8 @@ rb_id_table_foreach_values_with_replace(struct rb_id_table *tbl, rb_id_table_for ret = (*replace)(&val, data, TRUE); tbl->items[i].val = val; } - else if (ret == ID_TABLE_STOP) + + if (ret == ID_TABLE_STOP) return; } }