1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-09 18:25:58 +01:00

Remove dead code (cache.GetLast).

This commit is contained in:
Juliusz Chroboczek 2020-10-03 13:15:30 +02:00
parent 28b7c6d54d
commit bbd5ce0c75
2 changed files with 0 additions and 20 deletions

View file

@ -135,21 +135,6 @@ func (cache *Cache) Get(seqno uint16, result []byte) uint16 {
return 0 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 { func (cache *Cache) GetAt(seqno uint16, index uint16, result []byte) uint16 {
cache.mu.Lock() cache.mu.Lock()
defer cache.mu.Unlock() defer cache.mu.Unlock()

View file

@ -33,11 +33,6 @@ func TestCache(t *testing.T) {
if !bytes.Equal(buf[:l], buf1) { if !bytes.Equal(buf[:l], buf1) {
t.Errorf("Couldn't get 13 at %v", i1) 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) l = cache.Get(17, buf)
if !bytes.Equal(buf[:l], buf2) { if !bytes.Equal(buf[:l], buf2) {
t.Errorf("Couldn't get 17") t.Errorf("Couldn't get 17")