You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
335 B

  1. // +build go1.3
  2. package quotedprintable
  3. import (
  4. "bytes"
  5. "sync"
  6. )
  7. var bufPool = sync.Pool{
  8. New: func() interface{} {
  9. return new(bytes.Buffer)
  10. },
  11. }
  12. func getBuffer() *bytes.Buffer {
  13. return bufPool.Get().(*bytes.Buffer)
  14. }
  15. func putBuffer(buf *bytes.Buffer) {
  16. if buf.Len() > 1024 {
  17. return
  18. }
  19. buf.Reset()
  20. bufPool.Put(buf)
  21. }