summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-21 10:14:04 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-21 10:14:04 (GMT)
commit9296bd49da1b75731e4ccf48e6517c59d21a700b (patch)
tree0d5e4be52bfdd4e4d9610515bcc15238ab6f5c8b /re.c
parent6e19e1b87657d12d4e6fe2257462287ebcf67d40 (diff)
* include/ruby/ruby.h, re.c: support write barrier for T_REGEXP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41530 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 dbcbeb4..cd1f997 100644
--- a/re.c
+++ b/re.c
@@ -2438,7 +2438,7 @@ rb_reg_initialize(VALUE obj, const char *s, long len, rb_encoding *enc,
options & ARG_REG_OPTION_MASK, err,
sourcefile, sourceline);
if (!re->ptr) return -1;
- re->src = rb_enc_str_new(s, len, enc);
+ OBJ_WRITE(obj, (VALUE *)&re->src, rb_enc_str_new(s, len, enc));
OBJ_FREEZE(re->src);
RB_GC_GUARD(unescaped);
return 0;
@@ -2470,10 +2470,10 @@ rb_reg_initialize_str(VALUE obj, VALUE str, int options, onig_errmsg_buffer err,
static VALUE
rb_reg_s_alloc(VALUE klass)
{
- NEWOBJ_OF(re, struct RRegexp, klass, T_REGEXP);
+ NEWOBJ_OF(re, struct RRegexp, klass, T_REGEXP | (RGENGC_WB_PROTECTED_REGEXP ? FL_WB_PROTECTED : 0));
re->ptr = 0;
- re->src = 0;
+ OBJ_WRITE(re, (VALUE *)&re->src, 0);
re->usecnt = 0;
return (VALUE)re;