We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1753f7 commit 3101938Copy full SHA for 3101938
bytesconv.go
@@ -11,27 +11,18 @@ import (
11
"math"
12
"net"
13
"reflect"
14
- "strings"
15
"sync"
16
"time"
17
"unsafe"
18
)
19
20
// AppendHTMLEscape appends html-escaped s to dst and returns the extended dst.
21
func AppendHTMLEscape(dst []byte, s string) []byte {
22
- if strings.IndexByte(s, '&') < 0 &&
23
- strings.IndexByte(s, '<') < 0 &&
24
- strings.IndexByte(s, '>') < 0 &&
25
- strings.IndexByte(s, '"') < 0 &&
26
- strings.IndexByte(s, '\'') < 0 {
27
-
28
- // fast path - nothing to escape
29
- return append(dst, s...)
30
- }
+ var (
+ prev int
+ sub string
+ )
31
32
- // slow path
33
- var prev int
34
- var sub string
35
for i, n := 0, len(s); i < n; i++ {
36
sub = ""
37
switch s[i] {
0 commit comments