Further reduce heap allocs (#56)

* work on tracking more heap allocations down

* write own heapless IP AppendFormatAddr functions

* remove potential Error method allocations

* more logging
This commit is contained in:
Pat Whittingslow
2026-03-15 00:11:59 +01:00
committed by GitHub
parent de2e756628
commit 376e1a0b4f
8 changed files with 245 additions and 23 deletions
+10
View File
@@ -3,6 +3,7 @@ package lneto
import (
"errors"
"fmt"
"strconv"
)
type ValidateFlags uint64
@@ -83,3 +84,12 @@ type BitPosErr struct {
func (bpe *BitPosErr) Error() string {
return fmt.Sprintf("%s at bits %d..%d", bpe.Err.Error(), bpe.BitStart, bpe.BitStart+bpe.BitLen)
}
func (bpe *BitPosErr) AppendError(dst []byte) []byte {
dst = append(dst, bpe.Err.Error()...)
dst = append(dst, ": bits "...)
dst = strconv.AppendUint(dst, uint64(bpe.BitStart), 10)
dst = append(dst, '.', '.')
dst = strconv.AppendUint(dst, uint64(bpe.BitStart+bpe.BitLen), 10)
return dst
}