From: Brad Fitzpatrick Date: Tue, 20 Nov 2018 18:35:56 +0000 (+0000) Subject: mime: remove allocation introduced in recent fix X-Git-Tag: go1.12beta1~299 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=aadffd5b675254ce6235b74353ac260d2a5848e1;p=gostls13.git 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 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- diff --git a/src/mime/mediatype.go b/src/mime/mediatype.go index fc6e0d0673..05390773a8 100644 --- a/src/mime/mediatype.go +++ b/src/mime/mediatype.go @@ -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