Code cleanup: removed redundant unhex

This commit is contained in:
Aliaksandr Valialkin
2015-11-30 19:33:32 +02:00
parent 3e74ae6293
commit 3e3d68aed2
2 changed files with 2 additions and 15 deletions
+2 -2
View File
@@ -391,8 +391,8 @@ func decodeArgAppend(dst, src []byte, decodePlus bool) []byte {
if i+2 >= n {
return append(dst, src[i:]...)
}
x1 := unhex(src[i+1])
x2 := unhex(src[i+2])
x1 := hexbyte2int(src[i+1])
x2 := hexbyte2int(src[i+2])
if x1 < 0 || x2 < 0 {
dst = append(dst, c)
} else {
-13
View File
@@ -232,19 +232,6 @@ func unsafeBytesToStr(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
func unhex(c byte) int {
if c >= '0' && c <= '9' {
return int(c - '0')
}
if c >= 'a' && c <= 'f' {
return 10 + int(c-'a')
}
if c >= 'A' && c <= 'F' {
return 10 + int(c-'A')
}
return -1
}
func appendQuotedArg(dst, v []byte) []byte {
for _, c := range v {
if c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '/' || c == '.' {