less inefficient compaction

This commit is contained in:
Ted Unangst 2019-04-16 22:36:05 -04:00
parent 61b91a84f1
commit ffcd597027
1 changed files with 5 additions and 4 deletions

9
fun.go
View File

@ -64,13 +64,14 @@ func reverbolate(honks []*Honk) {
return e
}
h.HTML = template.HTML(re_emus.ReplaceAllStringFunc(string(h.HTML), emuxifier))
j := 0
for i := 0; i < len(h.Donks); i++ {
if zap[h.Donks[i]] {
copy(h.Donks[i:], h.Donks[i+1:])
h.Donks = h.Donks[:len(h.Donks)-1]
i--
if !zap[h.Donks[i]] {
h.Donks[j] = h.Donks[i]
j++
}
}
h.Donks = h.Donks[:j]
}
}