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>
|
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
|
* array.c (recursive_equal): fix to return true when self and other
|
||||||
|
|
|
@ -894,16 +894,13 @@ public
|
||||||
#
|
#
|
||||||
def compare_stream(a, b)
|
def compare_stream(a, b)
|
||||||
bsize = fu_stream_blksize(a, b)
|
bsize = fu_stream_blksize(a, b)
|
||||||
sa = sb = nil
|
sa = ""
|
||||||
while sa == sb
|
sb = ""
|
||||||
sa = a.read(bsize)
|
begin
|
||||||
sb = b.read(bsize)
|
a.read(bsize, sa)
|
||||||
unless sa and sb
|
b.read(bsize, sb)
|
||||||
if sa.nil? and sb.nil?
|
return true if sa.empty? && sb.empty?
|
||||||
return true
|
end while sa == sb
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue