]> Cypherpunks.ru repositories - gostls13.git/commit
bufio: make Reader.Reset and Writer.Reset work on the zero value
authorJoe Tsai <joetsai@digital-static.net>
Wed, 4 Aug 2021 07:57:07 +0000 (00:57 -0700)
committerJoe Tsai <joetsai@digital-static.net>
Sat, 11 Sep 2021 04:44:12 +0000 (04:44 +0000)
commita50225a0dc1e83449a76b80b2fbed77af516483c
treeb4aba706a29947b7d94ab1cf5b50668902f3a728
parentcf2fe5d6f12f075f265ba067869fc5f0e3b23ff0
bufio: make Reader.Reset and Writer.Reset work on the zero value

For batch allocation reasons, it would be useful to nest a
bufio.Reader or bufio.Writer in a struct as a value,
rather than a pointer. When the Reset method is called,
have it use the default buffer size if the buffer is nil.

Fixes #45374

Change-Id: I80df18a13575431428a42ed150a1579de1282637
Reviewed-on: https://go-review.googlesource.com/c/go/+/345570
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/bufio/bufio.go
src/bufio/bufio_test.go