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 | b6cbca1b342f5072b041de99c2a2c0dc2a45ab37 (patch) | |
| tree | d9e06dc2c8343c851167b692fbe469544994d9b9 /ext | |
| parent | 78ede09977b7274c60e07ae91d73cddc6ed128ce (diff) | |
| download | ruby-b6cbca1b342f5072b041de99c2a2c0dc2a45ab37.tar.gz ruby-b6cbca1b342f5072b041de99c2a2c0dc2a45ab37.tar.xz ruby-b6cbca1b342f5072b041de99c2a2c0dc2a45ab37.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@16387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
| -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 8c94d1c60..99c0451e3 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); |
