Skip to content

Commit b8353a8

Browse files
committed
test_all_ractors_multi_ractor: WIP encoding
1 parent dd87959 commit b8353a8

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

encoding.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,11 @@ enc_from_index(struct enc_table *enc_table, int index)
408408
rb_encoding *
409409
rb_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

414418
int
@@ -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;

transcode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
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

0 commit comments

Comments
 (0)