diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-13 19:45:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-13 19:45:35 +0000 |
commit | 27e492bec76b039f69678c42942d113e1f48d811 (patch) | |
tree | 39b8e2866afd41f828358eb6403fe7c48bad4fc2 /re.c | |
parent | be0197054c8c9634f413bc472425a1a8650c77cd (diff) |
* marshal.c (r_object0): register regexp object before encoding
name. [ruby-dev:40414]
* re.c (rb_reg_alloc, rb_reg_init_str): split from rb_reg_new_str.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -2419,9 +2419,20 @@ rb_reg_s_alloc(VALUE klass) } VALUE +rb_reg_alloc(void) +{ + return rb_reg_s_alloc(rb_cRegexp); +} + +VALUE rb_reg_new_str(VALUE s, int options) { - VALUE re = rb_reg_s_alloc(rb_cRegexp); + return rb_reg_init_str(rb_reg_alloc(), s, options); +} + +VALUE +rb_reg_init_str(VALUE re, VALUE s, int options) +{ onig_errmsg_buffer err = ""; if (rb_reg_initialize_str(re, s, options, err, NULL, 0) != 0) { @@ -2440,7 +2451,7 @@ rb_reg_new_ary(VALUE ary, int opt) VALUE rb_enc_reg_new(const char *s, long len, rb_encoding *enc, int options) { - VALUE re = rb_reg_s_alloc(rb_cRegexp); + VALUE re = rb_reg_alloc(); onig_errmsg_buffer err = ""; if (rb_reg_initialize(re, s, len, enc, options, err, NULL, 0) != 0) { @@ -2459,7 +2470,7 @@ rb_reg_new(const char *s, long len, int options) VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline) { - VALUE re = rb_reg_s_alloc(rb_cRegexp); + VALUE re = rb_reg_alloc(); onig_errmsg_buffer err = ""; if (!str) str = rb_str_new(0,0); |