diff --git a/ChangeLog b/ChangeLog index 4eb6eccce1..536fbbad35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 17 01:57:06 2007 Nobuyoshi Nakada + + * re.c (rb_reg_initialize_m): allow binary encoding option. + [ruby-dev:32083] + Tue Oct 16 19:48:01 2007 Nobuyoshi Nakada * re.c (rb_reg_s_union): check for encoding of original object. diff --git a/re.c b/re.c index b117cb4651..d6bff5ea94 100644 --- a/re.c +++ b/re.c @@ -1573,7 +1573,7 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self) int flags = 0; VALUE str; - if (argc == 0 || argc > 2) { + if (argc == 0 || argc > 3) { rb_raise(rb_eArgError, "wrong number of arguments"); } if (TYPE(argv[0]) == T_REGEXP) { @@ -1600,7 +1600,17 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self) if (FIXNUM_P(argv[1])) flags = FIX2INT(argv[1]); else if (RTEST(argv[1])) flags = ONIG_OPTION_IGNORECASE; } + if (argc == 3 && !NIL_P(argv[2])) { + char *kcode = StringValuePtr(argv[2]); + if (kcode[0] == 'n' || kcode[1] == 'N') { + flags |= ARG_KCODE_NONE; + } + else { + rb_warning("encoding option is obsolete - %s", kcode); + } + } str = argv[0]; + StringValueCStr(str); if (rb_reg_initialize_str(self, str, flags, err)) { rb_reg_raise_str(str, flags, err); } diff --git a/version.h b/version.h index 78a54e255a..8158ad959f 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-10-16" +#define RUBY_RELEASE_DATE "2007-10-17" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20071016 +#define RUBY_RELEASE_CODE 20071017 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 16 +#define RUBY_RELEASE_DAY 17 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[];