@@ -1139,7 +1139,7 @@ search_required(const rb_box_t *box, VALUE fname, volatile VALUE *path, feature_
11391139 // not already a feature and not found as a dynamic library.
11401140 if (!ft && type != loadable_ext_rb ) {
11411141 rb_vm_t * vm = GET_VM ();
1142- if (vm -> static_ext_inits ) {
1142+ if (vm -> static_ext_inits . num_entries ) {
11431143 VALUE lookup_name = tmp ;
11441144 // Append ".so" if not already present so for example "etc" can find "etc.so".
11451145 // We always register statically linked extensions with a ".so" extension.
@@ -1149,7 +1149,7 @@ search_required(const rb_box_t *box, VALUE fname, volatile VALUE *path, feature_
11491149 rb_str_cat_cstr (lookup_name , ".so" );
11501150 }
11511151 ftptr = RSTRING_PTR (lookup_name );
1152- if (st_lookup (vm -> static_ext_inits , (st_data_t )ftptr , NULL )) {
1152+ if (st_lookup (& vm -> static_ext_inits , (st_data_t )ftptr , NULL )) {
11531153 * path = rb_filesystem_str_new_cstr (ftptr );
11541154 RB_GC_GUARD (lookup_name );
11551155 return 's' ;
@@ -1215,7 +1215,7 @@ run_static_ext_init(VALUE vm_ptr, VALUE feature_value)
12151215 st_data_t key = (st_data_t )feature ;
12161216 st_data_t init_func ;
12171217
1218- if (vm -> static_ext_inits && st_delete (vm -> static_ext_inits , & key , & init_func )) {
1218+ if (st_delete (& vm -> static_ext_inits , & key , & init_func )) {
12191219 ((void (* )(void ))init_func )();
12201220 return Qtrue ;
12211221 }
@@ -1490,19 +1490,13 @@ register_init_ext(st_data_t *key, st_data_t *value, st_data_t init, int existing
14901490void
14911491ruby_init_ext (const char * name , void (* init )(void ))
14921492{
1493- st_table * inits_table ;
14941493 rb_vm_t * vm = GET_VM ();
14951494 const rb_box_t * box = rb_loading_box ();
14961495
14971496 if (feature_provided ((rb_box_t * )box , name , 0 ))
14981497 return ;
14991498
1500- inits_table = vm -> static_ext_inits ;
1501- if (!inits_table ) {
1502- inits_table = st_init_strtable ();
1503- vm -> static_ext_inits = inits_table ;
1504- }
1505- st_update (inits_table , (st_data_t )name , register_init_ext , (st_data_t )init );
1499+ st_update (& vm -> static_ext_inits , (st_data_t )name , register_init_ext , (st_data_t )init );
15061500}
15071501
15081502/*
0 commit comments