From bbd5ce0c7595b2003a70be5d7d057e49ce9e56f5 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sat, 3 Oct 2020 13:15:30 +0200 Subject: [PATCH] Remove dead code (cache.GetLast). --- packetcache/packetcache.go | 15 --------------- packetcache/packetcache_test.go | 5 ----- 2 files changed, 20 deletions(-) diff --git a/packetcache/packetcache.go b/packetcache/packetcache.go index 7894054..2d8a6ea 100644 --- a/packetcache/packetcache.go +++ b/packetcache/packetcache.go @@ -135,21 +135,6 @@ func (cache *Cache) Get(seqno uint16, result []byte) uint16 { return 0 } -func (cache *Cache) GetLast(result []byte) uint16 { - cache.mu.Lock() - defer cache.mu.Unlock() - - i := cache.tail - 1 - if i >= uint16(len(cache.entries)) { - i = 0 - } - - return uint16(copy( - result[:cache.entries[i].length], - cache.entries[i].buf[:]), - ) -} - func (cache *Cache) GetAt(seqno uint16, index uint16, result []byte) uint16 { cache.mu.Lock() defer cache.mu.Unlock() diff --git a/packetcache/packetcache_test.go b/packetcache/packetcache_test.go index a4509d4..5188e2b 100644 --- a/packetcache/packetcache_test.go +++ b/packetcache/packetcache_test.go @@ -33,11 +33,6 @@ func TestCache(t *testing.T) { if !bytes.Equal(buf[:l], buf1) { t.Errorf("Couldn't get 13 at %v", i1) } - l = cache.GetLast(buf) - if !bytes.Equal(buf[:l], buf2) { - t.Errorf("Couldn't get last") - } - l = cache.Get(17, buf) if !bytes.Equal(buf[:l], buf2) { t.Errorf("Couldn't get 17")