1
0
mirror of https://github.com/golang/go synced 2024-11-26 22:01:27 -07:00

mime: remove allocation introduced in recent fix

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>
This commit is contained in:
Brad Fitzpatrick 2018-11-20 18:35:56 +00:00
parent 9ef1455324
commit aadffd5b67

View File

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