]> Cypherpunks repositories - gostls13.git/commitdiff
mime: remove allocation introduced in recent fix
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 20 Nov 2018 18:35:56 +0000 (18:35 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 20 Nov 2018 19:09:38 +0000 (19:09 +0000)
CL 150417 was submitted before I could recommend this change to remove
an unnecessary allocation.

Updates #28849

Change-Id: I4cd655f62bb3d00eda6c997f074785385bceee0c
Reviewed-on: https://go-review.googlesource.com/c/150498
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/mime/mediatype.go

index fc6e0d0673d5481d11441833436c59a164fa8aab..05390773a8afa98272c7e2ca55d582248deb08ce 100644 (file)
@@ -56,7 +56,8 @@ func FormatMediaType(t string, param map[string]string) string {
 
                b.WriteByte('"')
                offset := 0
-               for index, character := range []byte(value) {
+               for index := 0; index < len(value); index++ {
+                       character := value[index]
                        if character == '"' || character == '\\' {
                                b.WriteString(value[offset:index])
                                offset = index