summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-02 14:36:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-02 14:36:25 +0000
commitd9274e7d6bbffd15291ffc6bdd5fefbde79f5cb8 (patch)
treeb611b62f1dccaaaaf76d013e3fab3569c1b0b395 /re.c
parent46e848a65a866663161edecc81d1b46aa3e36de3 (diff)
* parse.y (reg_compile_gen): set error if failed to compile regexp
literal. [ruby-dev:31336] * re.c (rb_reg_compile): should not use regexp which could not get initialized. [ruby-dev:31333] return error message to let the parser know it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/re.c b/re.c
index f8af10a7f3..b3d05e5b8f 100644
--- a/re.c
+++ b/re.c
@@ -1521,14 +1521,14 @@ rb_reg_new(const char *s, long len, int options)
}
VALUE
-rb_reg_compile(const char *s, long len, int options, const char *file, int line)
+rb_reg_compile(const char *s, long len, int options)
{
VALUE re = rb_reg_s_alloc(rb_cRegexp);
char err[ONIG_MAX_ERROR_MESSAGE_LEN];
if (rb_reg_initialize(re, s, len, options, err) != 0) {
- VALUE desc = rb_reg_desc(s, len, re);
- rb_compile_error(file, line, "%s: %s", err, RSTRING_PTR(desc));
+ VALUE desc = rb_reg_desc(s, len, 0);
+ return rb_sprintf("%s: %s", err, RSTRING_PTR(desc));
}
FL_SET(re, REG_LITERAL);
return re;