diff --git a/bytesconv.go b/bytesconv.go index a35b6068b6..a12bb95979 100644 --- a/bytesconv.go +++ b/bytesconv.go @@ -11,7 +11,6 @@ import ( "math" "net" "reflect" - "strings" "sync" "time" "unsafe" @@ -19,19 +18,11 @@ import ( // AppendHTMLEscape appends html-escaped s to dst and returns the extended dst. func AppendHTMLEscape(dst []byte, s string) []byte { - if strings.IndexByte(s, '&') < 0 && - strings.IndexByte(s, '<') < 0 && - strings.IndexByte(s, '>') < 0 && - strings.IndexByte(s, '"') < 0 && - strings.IndexByte(s, '\'') < 0 { - - // fast path - nothing to escape - return append(dst, s...) - } + var ( + prev int + sub string + ) - // slow path - var prev int - var sub string for i, n := 0, len(s); i < n; i++ { sub = "" switch s[i] {