From ca0def66591c6d8219d4b8ad863315f6c97483ce Mon Sep 17 00:00:00 2001 From: Yongjian Xu Date: Sat, 2 Jan 2010 11:09:22 +1100 Subject: [PATCH] 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 --- src/pkg/bytes/buffer.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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 -- 2.50.0