summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-01 21:54:59 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-01 21:54:59 +0000
commitdb37773e13fba8ccb28612361220638e702d4deb (patch)
tree72ffe3fbbb7762810ec3780c3004408ee5d0d693 /re.c
parente1c33162cf821b5251559564242e0d91ad29a79c (diff)
* include/ruby/oniguruma.h: updated to follow Oniguruma 5.9.2.
* re.c (make_regexp): use onig_new() instead of onig_alloc_init(). * re.c (rb_reg_to_s): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/re.c b/re.c
index 35af6aa..6ec3646 100644
--- a/re.c
+++ b/re.c
@@ -521,15 +521,11 @@ rb_reg_to_s(VALUE re)
if (*ptr == ':' && ptr[len-1] == ')') {
int r;
Regexp *rp;
- r = onig_alloc_init(&rp, ONIG_OPTION_DEFAULT,
- ONIGENC_CASE_FOLD_DEFAULT,
- rb_enc_get(re),
- OnigDefaultSyntax);
- if (r == 0) {
- ++ptr;
- len -= 2;
- err = (onig_compile(rp, ptr, ptr + len, NULL, NULL, 0) != 0);
- }
+
+ ++ptr;
+ len -= 2;
+ err = onig_new(&rp, ptr, ptr + len, ONIG_OPTION_DEFAULT,
+ rb_enc_get(re), OnigDefaultSyntax, NULL);
onig_free(rp);
}
if (err) {
@@ -745,18 +741,10 @@ make_regexp(const char *s, long len, rb_encoding *enc, int flags, onig_errmsg_bu
from that.
*/
- r = onig_alloc_init(&rp, flags, ONIGENC_CASE_FOLD_DEFAULT,
- enc, OnigDefaultSyntax);
+ r = onig_new(&rp, (UChar*)s, (UChar*)(s + len), flags,
+ enc, OnigDefaultSyntax, &einfo);
if (r) {
- onig_error_code_to_str((UChar*)err, r);
- return 0;
- }
-
- r = onig_compile(rp, (UChar*)s, (UChar*)(s + len), &einfo, sourcefile, sourceline);
-
- if (r != 0) {
- onig_free(rp);
- (void )onig_error_code_to_str((UChar*)err, r, &einfo);
+ onig_error_code_to_str((UChar*)err, r, &einfo);
return 0;
}
return rp;