1
0
mirror of https://github.com/golang/go synced 2024-09-25 13:20:13 -06:00

bytes: make Write and WriteString code look the same

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5540056
This commit is contained in:
Brad Fitzpatrick 2012-01-13 11:48:57 -08:00
parent eaecf357e7
commit 87ceb0cec7

View File

@ -97,8 +97,7 @@ func (b *Buffer) grow(n int) int {
func (b *Buffer) Write(p []byte) (n int, err error) {
b.lastRead = opInvalid
m := b.grow(len(p))
copy(b.buf[m:], p)
return len(p), nil
return copy(b.buf[m:], p), nil
}
// WriteString appends the contents of s to the buffer. The return