diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-12 06:09:53 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-12 06:09:53 +0000 |
commit | ab24f2b07729dc022cd954355d6797b48f1b1552 (patch) | |
tree | d9e06dc2c8343c851167b692fbe469544994d9b9 /ext/strscan | |
parent | b15fe02d194990c0eba875b733b41ae598e90211 (diff) | |
download | ruby-ab24f2b07729dc022cd954355d6797b48f1b1552.tar.gz |
* 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
Diffstat (limited to 'ext/strscan')
-rw-r--r-- | ext/strscan/strscan.c | 7 |
1 files changed, 5 insertions, 2 deletions
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); |