Commit ca0def66 authored by Yongjian Xu's avatar Yongjian Xu Committed by Rob Pike

Remove redundant size check in resize. Let callers worry about that and resize...

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
parent 5a443381
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment