4.0初步改造

This commit is contained in:
dexter
2022-02-02 10:39:09 +08:00
parent 6ace71fac6
commit b2489b2305
59 changed files with 6192 additions and 2061 deletions

17
util/bytes_pool.go Normal file
View File

@@ -0,0 +1,17 @@
package util
type BytesPool [][]byte
func (pool *BytesPool) Get(size int) (result []byte) {
if l := len(*pool); l > 0 {
result = (*pool)[l-1]
*pool = (*pool)[:l-1]
} else {
result = make([]byte, size, 10)
}
return
}
func (pool *BytesPool) Put(b []byte) {
*pool = append(*pool, b)
}