aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/objfile/pe.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2024-10-26 00:48:33 +0700
committerShulhan <m.shulhan@gmail.com>2026-04-14 21:51:40 +0700
commit8c0027ca7bde882aaa063044ac7c64ba5c7a6c92 (patch)
tree3180813916ed48f0cd2c22a97561cf988f636e91 /src/cmd/internal/objfile/pe.go
parent66e8a77e30babe052c023320d85af4c126413da8 (diff)
downloadgo-8c0027ca7bde882aaa063044ac7c64ba5c7a6c92.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.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/internal/objfile/pe.go b/src/cmd/internal/objfile/pe.go
index e94821298f..a0f2456ca3 100644
--- a/src/cmd/internal/objfile/pe.go
+++ b/src/cmd/internal/objfile/pe.go
@@ -30,11 +30,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