diff options
| author | Russ Cox <rsc@golang.org> | 2010-10-27 19:47:23 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2010-10-27 19:47:23 -0700 |
| commit | 69c4e9380bdd34eefe8c1e49f203964a17e5bee3 (patch) | |
| tree | ab3120dbe4a74ec3f609ab678fc1cef7a1943506 /src/pkg/debug | |
| parent | d8b5d039cd1bec151cc325973ff32bd34ebb0456 (diff) | |
| download | go-69c4e9380bdd34eefe8c1e49f203964a17e5bee3.tar.xz | |
use append
R=gri, r, r2
CC=golang-dev
https://golang.org/cl/2743042
Diffstat (limited to 'src/pkg/debug')
| -rw-r--r-- | src/pkg/debug/dwarf/type.go | 18 | ||||
| -rw-r--r-- | src/pkg/debug/macho/file.go | 10 |
2 files changed, 3 insertions, 25 deletions
diff --git a/src/pkg/debug/dwarf/type.go b/src/pkg/debug/dwarf/type.go index dc2e8b116d..902a545f86 100644 --- a/src/pkg/debug/dwarf/type.go +++ b/src/pkg/debug/dwarf/type.go @@ -451,14 +451,7 @@ func (d *Data) Type(off Offset) (Type, os.Error) { f.ByteSize, _ = kid.Val(AttrByteSize).(int64) f.BitOffset, _ = kid.Val(AttrBitOffset).(int64) f.BitSize, _ = kid.Val(AttrBitSize).(int64) - n := len(t.Field) - if n >= cap(t.Field) { - fld := make([]*StructField, n, n*2) - copy(fld, t.Field) - t.Field = fld - } - t.Field = t.Field[0 : n+1] - t.Field[n] = f + t.Field = append(t.Field, f) } } @@ -554,14 +547,7 @@ func (d *Data) Type(off Offset) (Type, os.Error) { case TagUnspecifiedParameters: tkid = &DotDotDotType{} } - n := len(t.ParamType) - if n >= cap(t.ParamType) { - param := make([]Type, n, n*2) - copy(param, t.ParamType) - t.ParamType = param - } - t.ParamType = t.ParamType[0 : n+1] - t.ParamType[n] = tkid + t.ParamType = append(t.ParamType, tkid) } case TagTypedef: diff --git a/src/pkg/debug/macho/file.go b/src/pkg/debug/macho/file.go index 4664f0190d..d2802266ef 100644 --- a/src/pkg/debug/macho/file.go +++ b/src/pkg/debug/macho/file.go @@ -302,15 +302,7 @@ func NewFile(r io.ReaderAt) (*File, os.Error) { } func (f *File) pushSection(sh *Section, r io.ReaderAt) { - n := len(f.Sections) - if n >= cap(f.Sections) { - m := (n + 1) * 2 - new := make([]*Section, n, m) - copy(new, f.Sections) - f.Sections = new - } - f.Sections = f.Sections[0 : n+1] - f.Sections[n] = sh + f.Sections = append(f.Sections, sh) sh.sr = io.NewSectionReader(r, int64(sh.Offset), int64(sh.Size)) sh.ReaderAt = sh.sr } |
