summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/st.c b/st.c
index 8be466bf73..fe7a21cf80 100644
--- a/st.c
+++ b/st.c
@@ -2238,4 +2238,19 @@ rb_hash_bulk_insert_into_st_table(long argc, const VALUE *argv, VALUE hash)
else
st_insert_generic(tab, argc, argv, hash);
}
+
+// to iterate iv_index_tbl
+st_data_t
+rb_st_nth_key(st_table *tab, st_index_t index)
+{
+ if (LIKELY(tab->entries_start == 0 &&
+ tab->num_entries == tab->entries_bound &&
+ index < tab->num_entries)) {
+ return tab->entries[index].key;
+ }
+ else {
+ rb_bug("unreachable");
+ }
+}
+
#endif