Deprecate stack buffer

This commit is contained in:
世界 2023-07-03 08:21:04 +08:00
parent d852e9c03d
commit c68251b6d0
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
18 changed files with 28 additions and 399 deletions

View file

@ -54,41 +54,19 @@ func NewSize(size int) *Buffer {
}
}
// Deprecated: use New instead.
func StackNew() *Buffer {
if common.UnsafeBuffer {
return &Buffer{
data: make([]byte, BufferSize),
start: ReversedHeader,
end: ReversedHeader,
}
} else {
return New()
}
return New()
}
// Deprecated: use NewPacket instead.
func StackNewPacket() *Buffer {
if common.UnsafeBuffer {
return &Buffer{
data: make([]byte, UDPBufferSize),
start: ReversedHeader,
end: ReversedHeader,
}
} else {
return NewPacket()
}
return NewPacket()
}
// Deprecated: use NewSize instead.
func StackNewSize(size int) *Buffer {
if size == 0 {
return &Buffer{}
}
if common.UnsafeBuffer {
return &Buffer{
data: Make(size),
}
} else {
return NewSize(size)
}
return NewSize(size)
}
func As(data []byte) *Buffer {