Pre-allocate the exact number of slice to be returned

This commit is contained in:
Ludovic Fauvet 2017-01-13 13:06:58 +01:00
parent 99ba1079f9
commit 8faf9e3d75

2
ftp.go
View File

@ -340,7 +340,7 @@ func parseRFC3659ListLine(line string) (*Entry, error) {
// parse file or folder name with starting or containing multiple whitespaces
func fieldsLsList(s string) []string {
n := 8
fields := make([]string, 0, n)
fields := make([]string, 0, n+1)
fieldStart := -1
nextbreak := false
for i, c := range s {