aboutsummaryrefslogtreecommitdiffstats
path: root/trie
diff options
context:
space:
mode:
authorOleg Kovalov <iamolegkovalov@gmail.com>2018-08-07 18:56:40 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-07 18:56:40 +0800
commitcf05ef9106779da0df62c0c03312fc489171aaa5 (patch)
treea2d5185dea85a478895b799da81e41f8e383cb52 /trie
parentde9b0660acf26edc3b261b805c1a3454e3c76321 (diff)
downloadgo-tangerine-cf05ef9106779da0df62c0c03312fc489171aaa5.tar
go-tangerine-cf05ef9106779da0df62c0c03312fc489171aaa5.tar.gz
go-tangerine-cf05ef9106779da0df62c0c03312fc489171aaa5.tar.bz2
go-tangerine-cf05ef9106779da0df62c0c03312fc489171aaa5.tar.lz
go-tangerine-cf05ef9106779da0df62c0c03312fc489171aaa5.tar.xz
go-tangerine-cf05ef9106779da0df62c0c03312fc489171aaa5.tar.zst
go-tangerine-cf05ef9106779da0df62c0c03312fc489171aaa5.zip
p2p, swarm, trie: avoid copying slices in loops (#17265)
Diffstat (limited to 'trie')
-rw-r--r--trie/node.go4
-rw-r--r--trie/trie.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/trie/node.go b/trie/node.go
index a06f1b389..1fafb7a53 100644
--- a/trie/node.go
+++ b/trie/node.go
@@ -55,7 +55,7 @@ var nilValueNode = valueNode(nil)
func (n *fullNode) EncodeRLP(w io.Writer) error {
var nodes [17]node
- for i, child := range n.Children {
+ for i, child := range &n.Children {
if child != nil {
nodes[i] = child
} else {
@@ -98,7 +98,7 @@ func (n valueNode) String() string { return n.fstring("") }
func (n *fullNode) fstring(ind string) string {
resp := fmt.Sprintf("[\n%s ", ind)
- for i, node := range n.Children {
+ for i, node := range &n.Children {
if node == nil {
resp += fmt.Sprintf("%s: <nil> ", indices[i])
} else {
diff --git a/trie/trie.go b/trie/trie.go
index 4284e30ad..e920ccd23 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -356,7 +356,7 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) {
// value that is left in n or -2 if n contains at least two
// values.
pos := -1
- for i, cld := range n.Children {
+ for i, cld := range &n.Children {
if cld != nil {
if pos == -1 {
pos = i