common: avoid allocation in isHex by iterating string bytes directly

This commit is contained in:
radik878 2025-11-01 01:40:18 +02:00 committed by GitHub
parent e6d34c1fee
commit 35953f7764
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -62,8 +62,8 @@ func isHex(str string) bool {
if len(str)%2 != 0 { if len(str)%2 != 0 {
return false return false
} }
for _, c := range []byte(str) { for i := 0; i < len(str); i++ {
if !isHexCharacter(c) { if !isHexCharacter(str[i]) {
return false return false
} }
} }