Rework encode to return pointer

This commit is contained in:
PhatPhuckDave
2024-07-22 23:09:32 +02:00
parent 73cc49788f
commit 3d0d8ce676
3 changed files with 12 additions and 12 deletions

View File

@@ -26,9 +26,9 @@ type (
}
)
func (p *PDU_HEADER) Encode() ([]uint8, error) {
buf := make([]uint8, 16)
err := p.EncodeInto(&buf)
func (p *PDU_HEADER) Encode() (*[]uint8, error) {
buf := ByteBufferPool.GetBuffer(int(p.Size()))
err := p.EncodeInto(buf)
return buf, err
}
func (p *PDU_HEADER) EncodeInto(buf *[]uint8) error {