summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongjian Xu <i3dmaster@gmail.com>2010-01-02 11:09:22 +1100
committerYongjian Xu <i3dmaster@gmail.com>2010-01-02 11:09:22 +1100
commitd59988a17f1f6ea43099f998174d18ab41bb04b3 (patch)
treec6067f423bf1c453ff89a4c8fb1cc0e1ae14be68
parentc2f55d2494eebed2349256a41313d6a7205d15e0 (diff)
downloadgo-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.go7
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