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 | c54a8adf268574218181aa03d5ce5b8a5f47dc21 (patch) | |
| tree | c6067f423bf1c453ff89a4c8fb1cc0e1ae14be68 /src/pkg/bytes/buffer.go | |
| parent | de8c680b354d974627c44ddcf937fc1b8577e2d4 (diff) | |
| download | golang-c54a8adf268574218181aa03d5ce5b8a5f47dc21.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>
Diffstat (limited to 'src/pkg/bytes/buffer.go')
| -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 |
