mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/fileutils.rb (module FileUtils): repatch [ruby-core:39622]
[Feature #5337]. improve performance of FileUtils.compare_stream. [ruby-core:47545] [Feature #7028] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a28a060db4
commit
2142287c86
2 changed files with 13 additions and 10 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun Nov 4 11:47:39 2012 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* lib/fileutils.rb (module FileUtils): repatch [ruby-core:39622]
|
||||
[Feature #5337]. improve performance of FileUtils.compare_stream.
|
||||
[ruby-core:47545] [Feature #7028]
|
||||
|
||||
Sun Nov 4 11:27:54 2012 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* array.c (recursive_equal): fix to return true when self and other
|
||||
|
|
|
@ -894,16 +894,13 @@ public
|
|||
#
|
||||
def compare_stream(a, b)
|
||||
bsize = fu_stream_blksize(a, b)
|
||||
sa = sb = nil
|
||||
while sa == sb
|
||||
sa = a.read(bsize)
|
||||
sb = b.read(bsize)
|
||||
unless sa and sb
|
||||
if sa.nil? and sb.nil?
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
sa = ""
|
||||
sb = ""
|
||||
begin
|
||||
a.read(bsize, sa)
|
||||
b.read(bsize, sb)
|
||||
return true if sa.empty? && sb.empty?
|
||||
end while sa == sb
|
||||
false
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue