mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-05 04:47:40 +03:00
Deprecate stack buffer
This commit is contained in:
parent
d852e9c03d
commit
c68251b6d0
18 changed files with 28 additions and 399 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue