Simplify buffer growing in Restorer.verifyFile

Suggested-by: Igor Fedorenko <igor@ifedorenko.com>
This commit is contained in:
greatroar authored and Michael Eischer committed 2021-09-19 13:10:55 +02:00
1 parent de8521ae56
commit d4225ec803
1 file changed
+1 -5
+1 -5
View File
@@ -397,11 +397,7 @@ func (res *Restorer) verifyFile(target string, node *restic.Node, buf []byte) ([
} }
if length > uint(cap(buf)) { if length > uint(cap(buf)) {
newcap := uint(2 * cap(buf)) buf = make([]byte, 2*length)
if newcap < length {
newcap = length
}
buf = make([]byte, newcap)
} }
buf = buf[:length] buf = buf[:length]