]> Cypherpunks repositories - gostls13.git/commitdiff
proc, eval: Don't assign address of an array to a slice.
authorIan Lance Taylor <iant@golang.org>
Mon, 30 Aug 2010 20:47:40 +0000 (13:47 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 30 Aug 2010 20:47:40 +0000 (13:47 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/2084041

src/pkg/debug/proc/regs_linux_amd64.go
src/pkg/exp/eval/eval_test.go

index a9f3569d3a7b51bf78fd59aec7775f5ae362f7d0..381be29b179c33192e1ffcca9345cf0b29da86b1 100644 (file)
@@ -71,7 +71,7 @@ func (r *amd64Regs) SetSP(val Word) os.Error {
        return r.setter(&r.PtraceRegs)
 }
 
-func (r *amd64Regs) Names() []string { return &names }
+func (r *amd64Regs) Names() []string { return names[0:] }
 
 func (r *amd64Regs) Get(i int) Word {
        switch i {
index cd4bbbbb0a4f4abecf261ebae0d55bf810337c01..fcdbeb85c06899416bce874bfda400d19ad14c06 100644 (file)
@@ -205,7 +205,7 @@ func toValue(val interface{}) Value {
 
 type testFunc struct{}
 
-func (*testFunc) NewFrame() *Frame { return &Frame{nil, &[2]Value{}} }
+func (*testFunc) NewFrame() *Frame { return &Frame{nil, make([]Value, 2)} }
 
 func (*testFunc) Call(t *Thread) {
        n := t.f.Vars[0].(IntValue).Get(t)
@@ -217,7 +217,7 @@ func (*testFunc) Call(t *Thread) {
 
 type oneTwoFunc struct{}
 
-func (*oneTwoFunc) NewFrame() *Frame { return &Frame{nil, &[2]Value{}} }
+func (*oneTwoFunc) NewFrame() *Frame { return &Frame{nil, make([]Value, 2)} }
 
 func (*oneTwoFunc) Call(t *Thread) {
        t.f.Vars[0].(IntValue).Set(t, 1)