1
0
mirror of https://github.com/fumiama/orbyte.git synced 2026-06-05 02:00:30 +08:00

fix(pbuf): remove buggy & redundant unsafe call

This commit is contained in:
源文雨
2025-10-02 14:55:35 +08:00
parent efe0ad501e
commit e231feb2d4

View File

@@ -4,7 +4,6 @@ import (
"bytes"
"io"
"reflect"
"unsafe"
)
// UserBuffer with customizable user data structure inside.
@@ -19,7 +18,6 @@ func (bufpooler[USRDAT]) New(config any, pooled UserBuffer[USRDAT]) UserBuffer[U
switch c := config.(type) {
case int:
pooled.Grow(c)
*(*[]byte)(unsafe.Pointer(&pooled)) = pooled.Bytes()[:c]
if c != pooled.Len() {
panic("unexpected bad buffer Grow")
}