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:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user