diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-07-09 01:38:33 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-07-09 16:21:02 +0900 |
commit | e2257831ab20915b839eeaff79c6ec45b498de77 (patch) | |
tree | 5b6f516ef614b00751328c81fc50f1b03a7515f9 /string.c | |
parent | 4e2f98be3907b85c6f470c41e7c00f53653b6e68 (diff) |
[Bug #19763] Raise same message exception for regexp
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8045
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3861,6 +3861,7 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str) { VALUE sub; VALUE initpos; + rb_encoding *enc = STR_ENC_GET(str); long pos; if (rb_scan_args(argc, argv, "11", &sub, &initpos) == 2) { @@ -3885,7 +3886,7 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str) return Qnil; } pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos, - rb_enc_check(str, sub), single_byte_optimizable(str)); + enc, single_byte_optimizable(str)); if (rb_reg_search(sub, str, pos, 0) < 0) { return Qnil; @@ -4182,7 +4183,7 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str) } if (RB_TYPE_P(sub, T_REGEXP)) { - /* enc = rb_get_check(str, sub); */ + /* enc = rb_enc_check(str, sub); */ pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos, enc, single_byte_optimizable(str)); |