fixup! fixup! fixup! fixup! Cleanup.

This commit is contained in:
2025-09-28 00:12:16 +01:00
parent 5dfbbff858
commit 6d758276b5
12 changed files with 4997 additions and 17 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ func (p *StringBuilderPool) Get() []byte {
// Put returns a string builder to the pool
func (p *StringBuilderPool) Put(buf []byte) {
if cap(buf) < 4096 { // Don't pool overly large buffers
if buf != nil && cap(buf) < 4096 { // Don't pool overly large buffers or nil buffers
buf = buf[:0] // Reset length but keep capacity
p.pool.Put(&buf)
}
@@ -63,7 +63,7 @@ func (p *ByteSlicePool) Get() []byte {
// Put returns a byte slice to the pool
func (p *ByteSlicePool) Put(buf []byte) {
if len(buf) == p.size {
if buf != nil && len(buf) == p.size {
p.pool.Put(&buf)
}
}