summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-16 10:48:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-16 10:48:02 +0000
commit5d8ba5a43faac6b74ab838c8b3fa22f07c387a0e (patch)
treeb04f75e3e3e4af406751c22f1b895e2f6a3ce9be /re.c
parent55eed62a43273d2728800d0af0140414a4b2dbc2 (diff)
* re.c (rb_reg_s_union): check for encoding of original object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/re.c b/re.c
index 37e46989e8..b117cb4651 100644
--- a/re.c
+++ b/re.c
@@ -1776,15 +1776,17 @@ rb_reg_s_union(VALUE self, VALUE args0)
for (i = 0; i < argc; i++) {
volatile VALUE v;
+ VALUE e = rb_ary_entry(args0, i);
if (0 < i)
rb_str_buf_cat2(source, "|");
- v = rb_check_regexp_type(rb_ary_entry(args0, i));
- rb_enc_check(tmp, v);
+ v = rb_check_regexp_type(e);
if (!NIL_P(v)) {
+ rb_enc_check(tmp, v);
v = rb_reg_to_s(v);
}
else {
- v = rb_reg_s_quote(Qnil, rb_ary_entry(args0, i));
+ rb_enc_check(tmp, e);
+ v = rb_reg_s_quote(Qnil, e);
}
rb_str_buf_append(source, v);
}