diff --git a/ChangeLog b/ChangeLog index b180578d7c..fd62693331 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Sep 30 04:03:43 2007 Tanaka Akira + + * re.c (Init_Regexp): test DEFAULT_KCODE in C code because + KCODE_EUC, etc are enum. + Sun Sep 30 00:55:40 2007 NAKAMURA Usaku * variable.c (obj_ivar_each): get rid of warning. diff --git a/re.c b/re.c index 871ee60738..b1c5fb93f1 100644 --- a/re.c +++ b/re.c @@ -2433,19 +2433,14 @@ Init_Regexp(void) rb_eRegexpError = rb_define_class("RegexpError", rb_eStandardError); onigenc_set_default_caseconv_table((UChar*)casetable); -#if DEFAULT_KCODE == KCODE_EUC - onigenc_set_default_encoding(ONIG_ENCODING_EUC_JP); -#else -#if DEFAULT_KCODE == KCODE_SJIS - onigenc_set_default_encoding(ONIG_ENCODING_SJIS); -#else -#if DEFAULT_KCODE == KCODE_UTF8 - onigenc_set_default_encoding(ONIG_ENCODING_UTF8); -#else - onigenc_set_default_encoding(ONIG_ENCODING_ASCII); -#endif -#endif -#endif + if (DEFAULT_KCODE == KCODE_EUC) + onigenc_set_default_encoding(ONIG_ENCODING_EUC_JP); + else if (DEFAULT_KCODE == KCODE_SJIS) + onigenc_set_default_encoding(ONIG_ENCODING_SJIS); + else if (DEFAULT_KCODE == KCODE_UTF8) + onigenc_set_default_encoding(ONIG_ENCODING_UTF8); + else + onigenc_set_default_encoding(ONIG_ENCODING_ASCII); rb_define_virtual_variable("$~", match_getter, match_setter); rb_define_virtual_variable("$&", last_match_getter, 0);