diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2018-11-20 18:35:56 +0000 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-11-20 19:09:38 +0000 |
commit | aadffd5b675254ce6235b74353ac260d2a5848e1 (patch) | |
tree | 83423ba81dde3f9ab52f8d8290c4b9e37fd0379d /src/mime | |
parent | 9ef145532420409a60542ec69ae3ed20a7d7c401 (diff) | |
download | go-aadffd5b675254ce6235b74353ac260d2a5848e1.tar.gz go-aadffd5b675254ce6235b74353ac260d2a5848e1.zip |
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>
Diffstat (limited to 'src/mime')
-rw-r--r-- | src/mime/mediatype.go | 3 |
1 files changed, 2 insertions, 1 deletions
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 |