File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -408,7 +408,11 @@ enc_from_index(struct enc_table *enc_table, int index)
408408rb_encoding *
409409rb_enc_from_index (int index )
410410{
411- return enc_from_index (& global_enc_table , index );
411+ rb_encoding * enc ;
412+ GLOBAL_ENC_TABLE_LOCKING (enc_table ) {
413+ enc = enc_from_index (enc_table , index );
414+ }
415+ return enc ;
412416}
413417
414418int
@@ -849,10 +853,7 @@ rb_enc_find_index(const char *name)
849853 }
850854 rb_encoding * enc ;
851855
852- if (i < 0 ) {
853- i = load_encoding (name );
854- }
855- else if (!(enc = rb_enc_from_index (i ))) {
856+ if (!(enc = rb_enc_from_index (i ))) {
856857 if (i != UNSPECIFIED_ENCODING ) {
857858 rb_raise (rb_eArgError , "encoding %s is not registered" , name );
858859 }
@@ -1540,6 +1541,7 @@ rb_locale_encindex(void)
15401541 enc_alias_internal (enc_table , "locale" , idx );
15411542 }
15421543 }
1544+ enc_alias_internal (enc_table , "locale" , idx );
15431545 }
15441546
15451547 return idx ;
Original file line number Diff line number Diff line change 1919#include "internal/object.h"
2020#include "internal/string.h"
2121#include "internal/transcode.h"
22+ #include "vm_sync.h"
2223#include "ruby/encoding.h"
2324#include "vm_sync.h"
2425
You can’t perform that action at this time.
0 commit comments