mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
preallocate array
This commit is contained in:
parent
ab635bd0f0
commit
6f56e62be4
1 changed files with 4 additions and 2 deletions
|
@ -52,9 +52,11 @@ func (cs *connectionStore) list() []*Connection {
|
||||||
cs.rw.RLock()
|
cs.rw.RLock()
|
||||||
defer cs.rw.RUnlock()
|
defer cs.rw.RUnlock()
|
||||||
|
|
||||||
l := []*Connection{}
|
l := make([]*Connection, len(cs.items))
|
||||||
|
index := 0
|
||||||
for _, conn := range cs.items {
|
for _, conn := range cs.items {
|
||||||
l = append(l, conn)
|
l[index] = conn
|
||||||
|
index++
|
||||||
}
|
}
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue