chore: use make([]byte, 6) and omit nil check

This commit is contained in:
guoguangwu 2023-07-13 13:38:58 +08:00
parent 31ccfc4039
commit de34abf766

View file

@ -573,7 +573,7 @@ func UnescapePunctuations(source []byte) []byte {
// ResolveNumericReferences resolve numeric references like 'Ӓ" .
func ResolveNumericReferences(source []byte) []byte {
cob := NewCopyOnWriteBuffer(source)
buf := make([]byte, 6, 6)
buf := make([]byte, 6)
limit := len(source)
ok := false
n := 0
@ -977,7 +977,7 @@ func (s *bytesFilter) Contains(b []byte) bool {
}
h := bytesHash(b) % uint64(len(s.slots))
slot := s.slots[h]
if slot == nil || len(slot) == 0 {
if len(slot) == 0 {
return false
}
for _, element := range slot {