From ae2395f55fccdef5ecee781b3be095fc6a0dca01 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 17 May 2022 14:45:08 +0300 Subject: [PATCH] vm: simplify (slot).Set code Refcounter handles nil items just fine. --- pkg/vm/slot.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pkg/vm/slot.go b/pkg/vm/slot.go index 4544ab8dd..661e796d8 100644 --- a/pkg/vm/slot.go +++ b/pkg/vm/slot.go @@ -23,13 +23,8 @@ func (s slot) Set(i int, item stackitem.Item, refs *refCounter) { if s[i] == item { return } - old := s[i] + refs.Remove(s[i]) s[i] = item - if old != nil { - refs.Remove(old) - } else { - *refs-- // Not really existing, but counted Null element. - } refs.Add(item) }