ext/-test-/string/enc_dummy.c
raw| 1 | #include "ruby.h" |
| 2 | #include "ruby/encoding.h" |
| 3 | |
| 4 | VALUE |
| 5 | bug_rb_define_dummy_encoding(VALUE self, VALUE name) |
| 6 | { |
| 7 | int idx = rb_define_dummy_encoding(RSTRING_PTR(name)); |
| 8 | return rb_enc_from_encoding(rb_enc_from_index(idx)); |
| 9 | } |
| 10 | |
| 11 | void |
| 12 | Init_string_enc_dummy(VALUE klass) |
| 13 | { |
| 14 | rb_define_singleton_method(klass, "rb_define_dummy_encoding", bug_rb_define_dummy_encoding, 1); |
| 15 | } |