1
0
mirror of https://github.com/golang/go synced 2024-11-12 09:10:21 -07:00

Remove redundant size check in resize. Let callers worry about that and resize should just do "resize".

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/181111
This commit is contained in:
Yongjian Xu 2010-01-02 11:09:22 +11:00 committed by Rob Pike
parent 5a44338159
commit ca0def6659

View File

@ -70,11 +70,8 @@ func (b *Buffer) resize(n int) {
if b.buf == nil && n <= len(b.bootstrap) {
buf = &b.bootstrap
} else {
buf = b.buf
if len(b.buf)+n > cap(b.buf) {
// not enough space anywhere
buf = make([]byte, 2*cap(b.buf)+n)
}
// not enough space anywhere
buf = make([]byte, 2*cap(b.buf)+n)
copy(buf, b.buf[b.off:])
}
b.buf = buf