1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* re.c (rb_reg_initialize): raise error if non-Unicode fixed

encoding option is specified for regexp literals with \u{}
  escapes.

* string.c (rb_str_squeeze_bang): should squeeze multibyte
  characters as well.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-12-17 16:06:21 +00:00
parent 50a0a86471
commit ebfcc5d933
4 changed files with 14 additions and 6 deletions

View file

@ -1,3 +1,12 @@
Tue Dec 18 00:26:12 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* re.c (rb_reg_initialize): raise error if non-Unicode fixed
encoding option is specified for regexp literals with \u{}
escapes.
* string.c (rb_str_squeeze_bang): should squeeze multibyte
characters as well.
Mon Dec 17 21:41:25 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Mon Dec 17 21:41:25 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/enc-setup.mak: extracts BUILTIN_ENCOBJS. * win32/enc-setup.mak: extracts BUILTIN_ENCOBJS.

2
re.c
View file

@ -1971,7 +1971,7 @@ rb_reg_initialize(VALUE obj, const char *s, int len, rb_encoding *enc,
return -1; return -1;
if (fixed_enc) { if (fixed_enc) {
if (fixed_enc != enc && enc != d_enc && fixed_enc != d_enc) { if (fixed_enc != enc && (options & ARG_ENCODING_FIXED)) {
strcpy(err, "character encodings differ"); strcpy(err, "character encodings differ");
return -1; return -1;
} }

View file

@ -3846,7 +3846,6 @@ rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
int i; int i;
if (argc == 0) { if (argc == 0) {
memset(squeez, 1, sizeof(squeez));
enc = rb_enc_get(str); enc = rb_enc_get(str);
} }
else { else {
@ -3868,7 +3867,7 @@ rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
int c = rb_enc_codepoint(s, send, enc); int c = rb_enc_codepoint(s, send, enc);
int clen = rb_enc_codelen(c, enc); int clen = rb_enc_codelen(c, enc);
if (c != save || !tr_find(c, squeez, del, nodel)) { if (c != save || (argc > 0 && !tr_find(c, squeez, del, nodel))) {
if (t != s) rb_enc_mbcput(c, t, enc); if (t != s) rb_enc_mbcput(c, t, enc);
save = c; save = c;
t += clen; t += clen;

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0" #define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-12-17" #define RUBY_RELEASE_DATE "2007-12-18"
#define RUBY_VERSION_CODE 190 #define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20071217 #define RUBY_RELEASE_CODE 20071218
#define RUBY_PATCHLEVEL 0 #define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0 #define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 12 #define RUBY_RELEASE_MONTH 12
#define RUBY_RELEASE_DAY 17 #define RUBY_RELEASE_DAY 18
#ifdef RUBY_EXTERN #ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_version[];