]> Cypherpunks repositories - gostls13.git/commit
bufio: implement large write forwarding in Writer.WriteString
authorCarlo Alberto Ferraris <cafxx@strayorange.com>
Fri, 21 Jan 2022 05:21:38 +0000 (14:21 +0900)
committerGopher Robot <gobot@golang.org>
Thu, 21 Apr 2022 23:41:03 +0000 (23:41 +0000)
commit21e1ffe7bc7793a8f1c1fca4dfa32f1f3f70681c
tree3b9a681cd6bc0cb345e47195d745ce7440096fac
parent01837ca7eb7d83dcbf760c032e1b25320f200510
bufio: implement large write forwarding in Writer.WriteString

Currently bufio.Writer implements forwarding to the underlying Writer
for large writes via Write, but it does not do the same for large
writes via WriteString.

If the underlying Writer is also a StringWriter, use the same "large
writes" logic also in WriteString while taking care to only check
once per call to WriteString whether the underlying Writer implements
StringWriter.

Change-Id: Id81901c07b035936816b9e41b1f5688e699ee8e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/380074
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/bufio/bufio.go
src/bufio/bufio_test.go