summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-02-06 10:06:47 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-02-06 10:06:47 +0000
commit766f2adb74adbe476e693c0e541ea265c5a62f36 (patch)
tree69bb1b6700d4a4dc749d6549972b2baab7541c52 /re.c
parentf3607247c805ad1f32acfca3ba3eeb844e590e9b (diff)
* re.c (rb_reg_initialize_m): shoule not preset "kcode" unless
encoding is explicitly specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/re.c b/re.c
index b837da8..4b8c821 100644
--- a/re.c
+++ b/re.c
@@ -1239,21 +1239,23 @@ rb_reg_initialize_m(argc, argv, self)
}
rb_reg_check(argv[0]);
flags = RREGEXP(argv[0])->ptr->options & 0xf;
- switch (RBASIC(argv[0])->flags & KCODE_MASK) {
- case KCODE_NONE:
- flags |= 16;
- break;
- case KCODE_EUC:
- flags |= 32;
- break;
- case KCODE_SJIS:
- flags |= 48;
- break;
- case KCODE_UTF8:
- flags |= 64;
- break;
- default:
- break;
+ if (FL_TEST(argv[0], KCODE_FIXED)) {
+ switch (RBASIC(argv[0])->flags & KCODE_MASK) {
+ case KCODE_NONE:
+ flags |= 16;
+ break;
+ case KCODE_EUC:
+ flags |= 32;
+ break;
+ case KCODE_SJIS:
+ flags |= 48;
+ break;
+ case KCODE_UTF8:
+ flags |= 64;
+ break;
+ default:
+ break;
+ }
}
s = RREGEXP(argv[0])->str;
len = RREGEXP(argv[0])->len;