mirror of
https://github.com/golang/go
synced 2024-11-21 21:04:41 -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
|
// not enough space anywhere
|
||||||
if len(b.buf)+n > cap(b.buf) {
|
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:])
|
copy(buf, b.buf[b.off:])
|
||||||
}
|
}
|
||||||
b.buf = buf
|
b.buf = buf
|
||||||
|
Loading…
Reference in New Issue
Block a user