tighter loop

master
Ted Unangst 5 years ago
parent e7a770bac2
commit ce850eb0cb

@ -79,27 +79,18 @@ func reverbolate(honks []*Honk) {
func osmosis(honks []*Honk, userid int64) []*Honk {
zwords := getzwords(userid)
collapse := false
for i, h := range honks {
j := 0
outer:
for _, h := range honks {
for _, z := range zwords {
if z.MatchString(h.Precis) || z.MatchString(h.Noise) {
honks[i] = nil
collapse = true
break
}
}
}
if collapse {
j := 0
for i := 0; i < len(honks); i++ {
if honks[i] != nil {
honks[j] = honks[i]
j++
continue outer
}
}
return honks[0:j]
honks[j] = h
j++
}
return honks
return honks[0:j]
}
func shortxid(xid string) string {

Loading…
Cancel
Save