]> Cypherpunks repositories - gostls13.git/commitdiff
Remove redundant size check in resize. Let callers worry about that and resize should...
authorYongjian Xu <i3dmaster@gmail.com>
Sat, 2 Jan 2010 00:09:22 +0000 (11:09 +1100)
committerRob Pike <r@golang.org>
Sat, 2 Jan 2010 00:09:22 +0000 (11:09 +1100)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/181111

src/pkg/bytes/buffer.go

index 954b74837f39e4cd8a699cc8eb22e232c90821ca..76126959fecb93c80e880e6eb4255edd67a9a9c0 100644 (file)
@@ -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