From: Yongjian Xu Date: Sat, 2 Jan 2010 00:09:22 +0000 (+1100) Subject: Remove redundant size check in resize. Let callers worry about that and resize should... X-Git-Tag: weekly.2010-01-05~14 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ca0def66591c6d8219d4b8ad863315f6c97483ce;p=gostls13.git 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 --- diff --git a/src/pkg/bytes/buffer.go b/src/pkg/bytes/buffer.go index 954b74837f..76126959fe 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