summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-17 16:06:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-17 16:06:21 +0000
commited059d7c2e503503f70b778811323c19a1d9c6aa (patch)
tree69cafd9bb322e0f26e0392c83854840428b7634d /string.c
parent4d5b3f2eb2bb2274aa4d584192e2c0c650a53f0b (diff)
downloadruby-ed059d7c2e503503f70b778811323c19a1d9c6aa.tar.gz
ruby-ed059d7c2e503503f70b778811323c19a1d9c6aa.tar.xz
ruby-ed059d7c2e503503f70b778811323c19a1d9c6aa.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@14275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/string.c b/string.c
index 62f5c3138..18624cc11 100644
--- a/string.c
+++ b/string.c
@@ -3846,7 +3846,6 @@ rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
int i;
if (argc == 0) {
- memset(squeez, 1, sizeof(squeez));
enc = rb_enc_get(str);
}
else {
@@ -3868,7 +3867,7 @@ rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
int c = rb_enc_codepoint(s, send, 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);
save = c;
t += clen;