aboutsummaryrefslogtreecommitdiff
path: root/args.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2017-07-21 16:45:47 +0300
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2017-07-21 16:45:47 +0300
commitae643c872d2c060154a4fb2162dc1c0ab1693ccd (patch)
tree789626128f40631dd1f1b7e324bebbba97c97ac5 /args.go
parentdecodeArgAppend* optimization: remove bounds check when decoding percent-enco... (diff)
downloadfasthttp-ae643c872d2c060154a4fb2162dc1c0ab1693ccd.tar.gz
fasthttp-ae643c872d2c060154a4fb2162dc1c0ab1693ccd.tar.bz2
fasthttp-ae643c872d2c060154a4fb2162dc1c0ab1693ccd.zip
decodeArgAppend code prettifying
Diffstat (limited to 'args.go')
-rw-r--r--args.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/args.go b/args.go
index c2974be..5d432f5 100644
--- a/args.go
+++ b/args.go
@@ -460,16 +460,16 @@ func decodeArgAppend(dst, src []byte) []byte {
}
// slow path
- for i, n := 0, len(src); i < n; i++ {
+ for i := 0; i < len(src); i++ {
c := src[i]
if c == '%' {
- if i+2 >= n {
+ if i+2 >= len(src) {
return append(dst, src[i:]...)
}
x2 := hex2intTable[src[i+2]]
x1 := hex2intTable[src[i+1]]
if x1 == 16 || x2 == 16 {
- dst = append(dst, c)
+ dst = append(dst, '%')
} else {
dst = append(dst, x1<<4|x2)
i += 2
@@ -495,16 +495,16 @@ func decodeArgAppendNoPlus(dst, src []byte) []byte {
}
// slow path
- for i, n := 0, len(src); i < n; i++ {
+ for i := 0; i < len(src); i++ {
c := src[i]
if c == '%' {
- if i+2 >= n {
+ if i+2 >= len(src) {
return append(dst, src[i:]...)
}
x2 := hex2intTable[src[i+2]]
x1 := hex2intTable[src[i+1]]
if x1 == 16 || x2 == 16 {
- dst = append(dst, c)
+ dst = append(dst, '%')
} else {
dst = append(dst, x1<<4|x2)
i += 2