summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-09-22 16:21:26 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-09-22 16:21:26 +0900
commit28eefb33c8d27e5711319873d065e5414d7ffe25 (patch)
tree613cd991350e759ef6ecf6052ee5520a76833c51 /variable.c
parentb4c328bebcf45b7a983f7e5ce29ba6ec57ed1a1a (diff)
variable.c: Rename rb_st_copy to rb_iv_tbl_copy
This function was created as a variant of st_copy with firing write barrier. It should have more explicit name, such as st_copy_with_write_barrier. But because it is used only for copying iv_tbl, so I rename it to rb_iv_tbl_copy now. If we face other use case than iv_tbl, we may want to rename it to more general name.
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/variable.c b/variable.c
index 1627467bd9..9fd075c21c 100644
--- a/variable.c
+++ b/variable.c
@@ -3360,12 +3360,13 @@ tbl_copy_i(st_data_t key, st_data_t value, st_data_t data)
return ST_CONTINUE;
}
-st_table *
-rb_st_copy(VALUE obj, struct st_table *orig_tbl)
+void
+rb_iv_tbl_copy(VALUE dst, VALUE src)
{
+ st_table *orig_tbl = RCLASS_IV_TBL(src);
st_table *new_tbl = st_copy(orig_tbl);
- st_foreach(new_tbl, tbl_copy_i, (st_data_t)obj);
- return new_tbl;
+ st_foreach(new_tbl, tbl_copy_i, (st_data_t)dst);
+ RCLASS_IV_TBL(dst) = new_tbl;
}
MJIT_FUNC_EXPORTED rb_const_entry_t *