Skip to content

Commit

Permalink
Remove dead code in oj_hash_init (#873)
Browse files Browse the repository at this point in the history
* Remove unnecessary rb_gc_register_address

We don't need to use rb_gc_register_address since cache_class is
allocated on the stack.

* Remove duplicate rb_undef_alloc_func
  • Loading branch information
peterzhu2118 committed Apr 6, 2023
1 parent 2a3b287 commit 5dd6f03
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions ext/oj/intern.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ void oj_hash_init(void) {
VALUE cache_class = rb_define_class_under(Oj, "Cache", rb_cObject);
rb_undef_alloc_func(cache_class);

rb_gc_register_address(&cache_class);
rb_undef_alloc_func(cache_class);

struct _cache *str_cache = cache_create(0, form_str, true, true);
str_cache_obj = Data_Wrap_Struct(cache_class, cache_mark, cache_free, str_cache);
rb_gc_register_address(&str_cache_obj);
Expand Down

0 comments on commit 5dd6f03

Please sign in to comment.