diff options
author | Yongjian Xu <i3dmaster@gmail.com> | 2010-01-02 11:09:22 +1100 |
---|---|---|
committer | Yongjian Xu <i3dmaster@gmail.com> | 2010-01-02 11:09:22 +1100 |
commit | d59988a17f1f6ea43099f998174d18ab41bb04b3 (patch) | |
tree | c6067f423bf1c453ff89a4c8fb1cc0e1ae14be68 | |
parent | c2f55d2494eebed2349256a41313d6a7205d15e0 (diff) | |
download | go-d59988a17f1f6ea43099f998174d18ab41bb04b3.tar.gz |
Remove redundant size check in resize. Let callers worry about that and resize should just do "resize".
R=golang-dev, r
CC=golang-dev
http://codereview.appspot.com/181111
Committer: Rob Pike <r@golang.org>
-rw-r--r-- | src/pkg/bytes/buffer.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/pkg/bytes/buffer.go b/src/pkg/bytes/buffer.go index 954b74837..76126959f 100644 --- a/src/pkg/bytes/buffer.go +++ b/src/pkg/bytes/buffer.go @@ -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 |