remove min function

This commit is contained in:
Cassondra Foesch 2021-08-11 13:29:16 +00:00
parent 0f6e8d5016
commit 1b6d816185
2 changed files with 6 additions and 8 deletions

View File

@ -1863,13 +1863,6 @@ func (f *File) Truncate(size int64) error {
return f.c.setfstat(f.handle, sshFileXferAttrSize, uint64(size))
}
func min(a, b int) int {
if a > b {
return b
}
return a
}
// normaliseError normalises an error into a more standard form that can be
// checked against stdlib errors like io.EOF or os.ErrNotExist.
func normaliseError(err error) error {

View File

@ -2313,7 +2313,12 @@ func benchmarkWrite(b *testing.B, bufsize int, delay time.Duration) {
}
for offset < size {
n, err := f2.Write(data[offset:min(len(data), offset+bufsize)])
buf := data[offset:]
if len(buf) > bufsize {
buf = buf[:bufsize]
}
n, err := f2.Write(buf)
if err != nil {
b.Fatal(err)
}