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

@ -85,9 +85,7 @@ func WriteRequest(writer io.Writer, request Request) error {
requestLen += len(request.Username)
}
_buffer := buf.StackNewSize(requestLen)
defer common.KeepAlive(_buffer)
buffer := common.Dup(_buffer)
buffer := buf.NewSize(requestLen)
defer buffer.Release()
common.Must(
@ -145,9 +143,7 @@ func ReadResponse(reader io.Reader) (response Response, err error) {
}
func WriteResponse(writer io.Writer, response Response) error {
_buffer := buf.StackNewSize(8)
defer common.KeepAlive(_buffer)
buffer := common.Dup(_buffer)
buffer := buf.NewSize(8)
defer buffer.Release()
common.Must(
buffer.WriteByte(0),