summaryrefslogtreecommitdiff
path: root/id_table.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-01-25 16:16:37 -0500
committerPeter Zhu <peter@peterzhu.ca>2022-01-25 16:51:16 -0500
commit142d5db1122cf28f1a5563c421f169923a9f2e79 (patch)
tree065562911b75d544dd92e34aef3d139d0bf6f38e /id_table.c
parent82f0580aa4a1a2da6ab3803dfb4f5e5a58820d3d (diff)
Support ID_TABLE_STOP for replace function
Iteration should top if the replace function returns ID_TABLE_STOP.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5486
Diffstat (limited to 'id_table.c')
-rw-r--r--id_table.c3
1 files changed, 2 insertions, 1 deletions
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;
}
}