Skip to content

Commit 7a82b6a

Browse files
1911860538gopherbot
1911860538
authored andcommitted
net/http: initialize Value with File length in cloneMultipartForm
Improve the initialization of the Value map in cloneMultipartForm by utilizing the length of the File map to optimize memory allocation. Change-Id: I97ba9e19b2718a75c270e6df21306f4c82656c71 GitHub-Last-Rev: a9683ba GitHub-Pull-Request: #69943 Reviewed-on: https://go-review.googlesource.com/c/go/+/621235 Reviewed-by: Christian Ekrem <[email protected]> Reviewed-by: Sean Liao <[email protected]> Reviewed-by: qiu laidongfeng2 <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Damien Neil <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> TryBot-Bypass: Dmitri Shuralyov <[email protected]>
1 parent a42e337 commit 7a82b6a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/net/http/clone.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func cloneMultipartForm(f *multipart.Form) *multipart.Form {
6868
Value: (map[string][]string)(Header(f.Value).Clone()),
6969
}
7070
if f.File != nil {
71-
m := make(map[string][]*multipart.FileHeader)
71+
m := make(map[string][]*multipart.FileHeader, len(f.File))
7272
for k, vv := range f.File {
7373
vv2 := make([]*multipart.FileHeader, len(vv))
7474
for i, v := range vv {

0 commit comments

Comments
 (0)