diff options
author | Oleg Kovalov <iamolegkovalov@gmail.com> | 2018-08-07 18:56:40 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-08-07 18:56:40 +0800 |
commit | cf05ef9106779da0df62c0c03312fc489171aaa5 (patch) | |
tree | a2d5185dea85a478895b799da81e41f8e383cb52 /swarm | |
parent | de9b0660acf26edc3b261b805c1a3454e3c76321 (diff) | |
download | dexon-cf05ef9106779da0df62c0c03312fc489171aaa5.tar.gz dexon-cf05ef9106779da0df62c0c03312fc489171aaa5.tar.zst dexon-cf05ef9106779da0df62c0c03312fc489171aaa5.zip |
p2p, swarm, trie: avoid copying slices in loops (#17265)
Diffstat (limited to 'swarm')
-rw-r--r-- | swarm/api/manifest.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/swarm/api/manifest.go b/swarm/api/manifest.go index 198ca22ce..fbd143f29 100644 --- a/swarm/api/manifest.go +++ b/swarm/api/manifest.go @@ -159,7 +159,7 @@ func (m *ManifestWalker) Walk(walkFn WalkFn) error { } func (m *ManifestWalker) walk(trie *manifestTrie, prefix string, walkFn WalkFn) error { - for _, entry := range trie.entries { + for _, entry := range &trie.entries { if entry == nil { continue } @@ -308,7 +308,7 @@ func (mt *manifestTrie) addEntry(entry *manifestTrieEntry, quitC chan bool) { } func (mt *manifestTrie) getCountLast() (cnt int, entry *manifestTrieEntry) { - for _, e := range mt.entries { + for _, e := range &mt.entries { if e != nil { cnt++ entry = e @@ -362,7 +362,7 @@ func (mt *manifestTrie) recalcAndStore() error { buffer.WriteString(`{"entries":[`) list := &Manifest{} - for _, entry := range mt.entries { + for _, entry := range &mt.entries { if entry != nil { if entry.Hash == "" { // TODO: paralellize err := entry.subtrie.recalcAndStore() |