Pre-allocate the exact number of slice to be returned
This commit is contained in:
2
ftp.go
2
ftp.go
@@ -340,7 +340,7 @@ func parseRFC3659ListLine(line string) (*Entry, error) {
|
|||||||
// parse file or folder name with starting or containing multiple whitespaces
|
// parse file or folder name with starting or containing multiple whitespaces
|
||||||
func fieldsLsList(s string) []string {
|
func fieldsLsList(s string) []string {
|
||||||
n := 8
|
n := 8
|
||||||
fields := make([]string, 0, n)
|
fields := make([]string, 0, n+1)
|
||||||
fieldStart := -1
|
fieldStart := -1
|
||||||
nextbreak := false
|
nextbreak := false
|
||||||
for i, c := range s {
|
for i, c := range s {
|
||||||
|
|||||||
Reference in New Issue
Block a user