diff options
| author | Shulhan <m.shulhan@gmail.com> | 2023-05-02 01:06:11 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2024-01-25 04:01:14 +0700 |
| commit | 8096b47dd09fcda8712f7a3c07dced5244123a4d (patch) | |
| tree | 26339e20861f0d89cff1cf3dc763d7b99b4aaee8 /src/cmd/internal/objfile/pe.go | |
| parent | 54386c4a7e68ab281545116220600f670e8f9e14 (diff) | |
| download | go-8096b47dd09fcda8712f7a3c07dced5244123a4d.tar.xz | |
all: prealloc slice with possible minimum capabilities
Diffstat (limited to 'src/cmd/internal/objfile/pe.go')
| -rw-r--r-- | src/cmd/internal/objfile/pe.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/internal/objfile/pe.go b/src/cmd/internal/objfile/pe.go index 4c4be1e6b7..df7e5f8cea 100644 --- a/src/cmd/internal/objfile/pe.go +++ b/src/cmd/internal/objfile/pe.go @@ -29,11 +29,11 @@ func openPE(r io.ReaderAt) (rawFile, error) { func (f *peFile) symbols() ([]Sym, error) { // Build sorted list of addresses of all symbols. // We infer the size of a symbol by looking at where the next symbol begins. - var addrs []uint64 + addrs := make([]uint64, 0, len(f.pe.Symbols)) imageBase, _ := f.imageBase() - var syms []Sym + syms := make([]Sym, 0, len(f.pe.Symbols)) for _, s := range f.pe.Symbols { const ( N_UNDEF = 0 // An undefined (extern) symbol |
