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

* .gdbinit (rp): REGEXP handling fixed.

* string.c (rb_str_rindex_m): need not to call rb_enc_check on
  regexp.

* re.c (unescape_escaped_nonascii): try ASCII-8BIT encoding for
  broken strings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-10-16 22:21:42 +00:00
parent 4709e330cf
commit 1e8bbf3154
4 changed files with 25 additions and 5 deletions

View file

@ -86,11 +86,17 @@ define rp
print (struct RString *)$arg0
else
if ($flags & RUBY_T_MASK) == RUBY_T_REGEXP
set $regsrc = ((struct RRegexp*)$arg0)->src
set $rsflags = ((struct RBasic*)$regsrc)->flags
printf "T_REGEXP: "
set print address off
output ((struct RRegexp*)$arg0)->str
output (char *)(($rsflags & RUBY_FL_USER1) ? \
((struct RString*)$regsrc)->as.heap.ptr : \
((struct RString*)$regsrc)->as.ary)
set print address on
printf " len:%ld ", ((struct RRegexp*)$arg0)->len
printf " len:%ld ", ($rsflags & RUBY_FL_USER1) ? \
((struct RString*)$regsrc)->as.heap.len : \
(($rsflags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
if $flags & RUBY_FL_USER6
printf "(none) "
end

View file

@ -64,6 +64,16 @@ Thu Oct 16 06:20:36 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* test/ruby/test_transcode.rb (TestTranscode#test_errors):
String#encode now works without any argument. [ruby-dev:36740]
Wed Oct 15 23:48:22 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* .gdbinit (rp): REGEXP handling fixed.
* string.c (rb_str_rindex_m): need not to call rb_enc_check on
regexp.
* re.c (unescape_escaped_nonascii): try ASCII-8BIT encoding for
broken strings.
Wed Oct 15 23:11:10 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/delegate.rb (DelegateClass): restored 1.8 behavior for

8
re.c
View file

@ -1967,8 +1967,12 @@ unescape_escaped_nonascii(const char **pp, const char *end, rb_encoding *enc,
l = rb_enc_precise_mbclen(chbuf, chbuf+chlen, enc);
if (MBCLEN_INVALID_P(l)) {
strcpy(err, "invalid multibyte escape");
return -1;
if (*encp == 0)
enc = *encp = rb_ascii8bit_encoding();
else if (*encp != rb_ascii8bit_encoding()) {
strcpy(err, "invalid multibyte escape");
return -1;
}
}
if (1 < chlen || (chbuf[0] & 0x80)) {
rb_str_buf_cat(buf, chbuf, chlen);

View file

@ -2355,7 +2355,7 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
case T_REGEXP:
/* enc = rb_get_check(str, sub); */
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
rb_enc_check(str, sub), single_byte_optimizable(str));
STR_ENC_GET(str), single_byte_optimizable(str));
if (!RREGEXP(sub)->ptr || RREGEXP_SRC_LEN(sub)) {
pos = rb_reg_adjust_startpos(sub, str, pos, 1);