mirror of
https://github.com/golang/go
synced 2024-11-25 07:57:56 -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:
parent
5a44338159
commit
ca0def6659
@ -70,11 +70,8 @@ func (b *Buffer) resize(n int) {
|
|||||||
if b.buf == nil && n <= len(b.bootstrap) {
|
if b.buf == nil && n <= len(b.bootstrap) {
|
||||||
buf = &b.bootstrap
|
buf = &b.bootstrap
|
||||||
} else {
|
} else {
|
||||||
buf = b.buf
|
|
||||||
if len(b.buf)+n > cap(b.buf) {
|
|
||||||
// not enough space anywhere
|
// not enough space anywhere
|
||||||
buf = make([]byte, 2*cap(b.buf)+n)
|
buf = make([]byte, 2*cap(b.buf)+n)
|
||||||
}
|
|
||||||
copy(buf, b.buf[b.off:])
|
copy(buf, b.buf[b.off:])
|
||||||
}
|
}
|
||||||
b.buf = buf
|
b.buf = buf
|
||||||
|
Loading…
Reference in New Issue
Block a user