merges r29146 and r29148 from trunk into ruby_1_9_2.

--
* string.c (tr_setup_table): initialize negating table when
  negating string is given. [ruby-core:31851]

* string.c (tr_find): add a sentence for the time when
  target characters include negating one.

* string.c (rb_str_count): move definition.
--
* string.c (tr_setup_table): fix bug in r29146.
  Initialize table even if cflag is 0; tr_find see whether
  del is empty or not.

* string.c (tr_find): nodel can't be NULL; if NULL, it means
  it is not specified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2010-10-23 10:02:41 +00:00
parent 0d069bd2df
commit d9cd722638
7 changed files with 48 additions and 17 deletions

View file

@ -76,9 +76,9 @@ class RDoc::Parser
elsif s.scan(/<%|%>/).length >= 4 || s.index("\x00") then
true
elsif 0.respond_to? :fdiv then
s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
s.count("\x00-\x7F", "^ -~\t\r\n").fdiv(s.size) > 0.3
else # HACK 1.8.6
(s.count("^ -~\t\r\n").to_f / s.size) > 0.3
(s.count("\x00-\x7F", "^ -~\t\r\n").to_f / s.size) > 0.3
end
end