From 69c4e9380bdd34eefe8c1e49f203964a17e5bee3 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Oct 2010 19:47:23 -0700 Subject: use append R=gri, r, r2 CC=golang-dev https://golang.org/cl/2743042 --- src/pkg/debug/dwarf/type.go | 18 ++---------------- src/pkg/debug/macho/file.go | 10 +--------- 2 files changed, 3 insertions(+), 25 deletions(-) (limited to 'src/pkg/debug') 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 } -- cgit v1.3-5-g9baa