diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2017-07-21 16:45:47 +0300 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2017-07-21 16:45:47 +0300 |
commit | ae643c872d2c060154a4fb2162dc1c0ab1693ccd (patch) | |
tree | 789626128f40631dd1f1b7e324bebbba97c97ac5 /args.go | |
parent | decodeArgAppend* optimization: remove bounds check when decoding percent-enco... (diff) | |
download | fasthttp-ae643c872d2c060154a4fb2162dc1c0ab1693ccd.tar.gz fasthttp-ae643c872d2c060154a4fb2162dc1c0ab1693ccd.tar.bz2 fasthttp-ae643c872d2c060154a4fb2162dc1c0ab1693ccd.zip |
decodeArgAppend code prettifying
Diffstat (limited to 'args.go')
-rw-r--r-- | args.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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 |