summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/marshal.c b/marshal.c
index c9170c6f37..f2d01809ca 100644
--- a/marshal.c
+++ b/marshal.c
@@ -693,10 +693,13 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
break;
case T_REGEXP:
- w_uclass(obj, rb_cRegexp, arg);
- w_byte(TYPE_REGEXP, arg);
- w_bytes(RREGEXP(obj)->str, RREGEXP(obj)->len, arg);
- w_byte((char)rb_reg_options(obj), arg);
+ w_uclass(obj, rb_cRegexp, arg);
+ w_byte(TYPE_REGEXP, arg);
+ {
+ int opts = rb_reg_options(obj);
+ w_bytes(RREGEXP_SRC_PTR(obj), RREGEXP_SRC_LEN(obj), arg);
+ w_byte((char)opts, arg);
+ }
break;
case T_ARRAY: