aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--re.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 87670541e5..4f337e81b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Oct 16 14:03:09 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * re.c (rb_reg_s_union): encoding of all regexp objects should
+ match. [ruby-dev:32076]
+
Tue Oct 16 13:49:41 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* encoding.c (enc_to_s): rename function.
diff --git a/re.c b/re.c
index 78a72f2779..1d3e144cf4 100644
--- a/re.c
+++ b/re.c
@@ -1997,6 +1997,7 @@ static VALUE
rb_reg_s_union(VALUE self, VALUE args0)
{
long argc = RARRAY_LEN(args0);
+
if (argc == 0) {
VALUE args[1];
args[0] = rb_str_new2("(?!)");
@@ -2018,11 +2019,14 @@ rb_reg_s_union(VALUE self, VALUE args0)
VALUE kcode_re = Qnil;
VALUE source = rb_str_buf_new(0);
VALUE args[3];
+ VALUE tmp = rb_ary_entry(args0, 0);
+
for (i = 0; i < argc; i++) {
volatile VALUE v;
if (0 < i)
rb_str_buf_cat2(source, "|");
v = rb_check_regexp_type(rb_ary_entry(args0, i));
+ rb_enc_check(tmp, v);
if (!NIL_P(v)) {
if (FL_TEST(v, KCODE_FIXED)) {
if (kcode == -1) {