summaryrefslogtreecommitdiff
path: root/src/pkg/exp/eval/func.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-01-17 12:40:45 +0100
committerOndřej Surý <ondrej@sury.org>2011-01-17 12:40:45 +0100
commit3e45412327a2654a77944249962b3652e6142299 (patch)
treebc3bf69452afa055423cbe0c5cfa8ca357df6ccf /src/pkg/exp/eval/func.go
parentc533680039762cacbc37db8dc7eed074c3e497be (diff)
downloadgolang-3e45412327a2654a77944249962b3652e6142299.tar.gz
Imported Upstream version 2011.01.12upstream/2011.01.12
Diffstat (limited to 'src/pkg/exp/eval/func.go')
-rw-r--r--src/pkg/exp/eval/func.go15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/pkg/exp/eval/func.go b/src/pkg/exp/eval/func.go
index e672d0783..cb1b579e4 100644
--- a/src/pkg/exp/eval/func.go
+++ b/src/pkg/exp/eval/func.go
@@ -43,16 +43,7 @@ type codeBuf struct {
func newCodeBuf() *codeBuf { return &codeBuf{make(code, 0, 16)} }
func (b *codeBuf) push(instr func(*Thread)) {
- n := len(b.instrs)
- if n >= cap(b.instrs) {
- a := make(code, n, n*2)
- for i := range b.instrs {
- a[i] = b.instrs[i]
- }
- b.instrs = a
- }
- b.instrs = b.instrs[0 : n+1]
- b.instrs[n] = instr
+ b.instrs = append(b.instrs, instr)
}
func (b *codeBuf) nextPC() uint { return uint(len(b.instrs)) }
@@ -60,9 +51,7 @@ func (b *codeBuf) nextPC() uint { return uint(len(b.instrs)) }
func (b *codeBuf) get() code {
// Freeze this buffer into an array of exactly the right size
a := make(code, len(b.instrs))
- for i := range b.instrs {
- a[i] = b.instrs[i]
- }
+ copy(a, b.instrs)
return code(a)
}