mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
core/filtermaps: use slices.Clone to copy filter maps
This commit is contained in:
parent
500497319e
commit
9d35412ac8
1 changed files with 2 additions and 5 deletions
|
|
@ -147,9 +147,7 @@ type filterMap []FilterRow
|
|||
// copies of the same map would result in data corruption, therefore a fast copy
|
||||
// should always be used in a read only way.
|
||||
func (fm filterMap) fastCopy() filterMap {
|
||||
c := make(filterMap, len(fm))
|
||||
copy(c, fm)
|
||||
return c
|
||||
return slices.Clone(fm)
|
||||
}
|
||||
|
||||
// fullCopy returns a copy of the given filter map, also making a copy of each
|
||||
|
|
@ -158,8 +156,7 @@ func (fm filterMap) fastCopy() filterMap {
|
|||
func (fm filterMap) fullCopy() filterMap {
|
||||
c := make(filterMap, len(fm))
|
||||
for i, row := range fm {
|
||||
c[i] = make(FilterRow, len(row))
|
||||
copy(c[i], row)
|
||||
c[i] = slices.Clone(row)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue