From ab24f2b07729dc022cd954355d6797b48f1b1552 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 12 May 2008 06:09:53 +0000 Subject: * re.c (rb_reg_prepare_re): made non static with small refactoring. * ext/strscan/strscan.c (strscan_do_scan): should adjust encoding before regex searching. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/strscan/strscan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ext/strscan') diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index 8c94d1c60d..99c0451e36 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -403,7 +403,9 @@ strscan_set_pos(VALUE self, VALUE v) static VALUE strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly) { + regex_t *rb_reg_prepare_re(VALUE re, VALUE str); struct strscanner *p; + regex_t *re; int ret; Check_Type(regex, T_REGEXP); @@ -413,13 +415,14 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly) if (S_RESTLEN(p) < 0) { return Qnil; } + re = rb_reg_prepare_re(regex, p->str); if (headonly) { - ret = onig_match(RREGEXP(regex)->ptr, (UChar* )CURPTR(p), + ret = onig_match(re, (UChar* )CURPTR(p), (UChar* )(CURPTR(p) + S_RESTLEN(p)), (UChar* )CURPTR(p), &(p->regs), ONIG_OPTION_NONE); } else { - ret = onig_search(RREGEXP(regex)->ptr, + ret = onig_search(re, (UChar* )CURPTR(p), (UChar* )(CURPTR(p) + S_RESTLEN(p)), (UChar* )CURPTR(p), (UChar* )(CURPTR(p) + S_RESTLEN(p)), &(p->regs), ONIG_OPTION_NONE); -- cgit v1.2.3