diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-02-24 15:33:50 +0900 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2020-03-14 16:00:46 +0900 |
commit | fa48a26d886d86469a0075d91d152252e9fc0c8c (patch) | |
tree | c4aa8e9c6587fefd1bd7be5bc5ed57879230b142 /transcode.c | |
parent | 3e7e1b965b06f3c843972d7e2f6e3d040374d67f (diff) |
Fixed symbol misused as ID
`rb_funcallv_public` and `rb_respond_to` require an `ID`, not a
`Symbol`. [Bug #16649]
(cherry picked from commit 8b6e2685a4b7c7de905f7ed60c02ef85e0724754)
Diffstat (limited to 'transcode.c')
-rw-r--r-- | transcode.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/transcode.c b/transcode.c index aeab90f9e6..1c9cc01f36 100644 --- a/transcode.c +++ b/transcode.c @@ -13,6 +13,7 @@ #include "internal.h" #include "transcode_data.h" #include <ctype.h> +#include "id.h" #define ENABLE_ECONV_NEWLINE_OPTION 1 @@ -23,7 +24,7 @@ static VALUE rb_eConverterNotFoundError; VALUE rb_cEncodingConverter; -static VALUE sym_invalid, sym_undef, sym_replace, sym_fallback, sym_aref; +static VALUE sym_invalid, sym_undef, sym_replace, sym_fallback; static VALUE sym_xml, sym_text, sym_attr; static VALUE sym_universal_newline; static VALUE sym_crlf_newline; @@ -2241,7 +2242,7 @@ method_fallback(VALUE fallback, VALUE c) static VALUE aref_fallback(VALUE fallback, VALUE c) { - return rb_funcall3(fallback, sym_aref, 1, &c); + return rb_funcallv_public(fallback, idAREF, 1, &c); } static void @@ -2535,7 +2536,7 @@ rb_econv_prepare_options(VALUE opthash, VALUE *opts, int ecflags) if (!NIL_P(v)) { VALUE h = rb_check_hash_type(v); if (NIL_P(h) - ? (rb_obj_is_proc(v) || rb_obj_is_method(v) || rb_respond_to(v, sym_aref)) + ? (rb_obj_is_proc(v) || rb_obj_is_method(v) || rb_respond_to(v, idAREF)) : (v = h, 1)) { if (NIL_P(newhash)) newhash = rb_hash_new(); @@ -4408,7 +4409,6 @@ Init_transcode(void) sym_undef = ID2SYM(rb_intern("undef")); sym_replace = ID2SYM(rb_intern("replace")); sym_fallback = ID2SYM(rb_intern("fallback")); - sym_aref = ID2SYM(rb_intern("[]")); sym_xml = ID2SYM(rb_intern("xml")); sym_text = ID2SYM(rb_intern("text")); sym_attr = ID2SYM(rb_intern("attr")); |