filtering: preallocate allow filters slice
This commit is contained in:
parent
1d6d85cff4
commit
aeb31f56e1
|
@ -593,7 +593,7 @@ func (d *DNSFilter) EnableFilters(async bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DNSFilter) enableFiltersLocked(async bool) {
|
func (d *DNSFilter) enableFiltersLocked(async bool) {
|
||||||
filters := make([]Filter, 1, len(d.conf.Filters)+len(d.conf.WhitelistFilters)+1)
|
filters := make([]Filter, 1, len(d.conf.Filters)+1)
|
||||||
filters[0] = Filter{
|
filters[0] = Filter{
|
||||||
ID: rulelist.URLFilterIDCustom,
|
ID: rulelist.URLFilterIDCustom,
|
||||||
Data: []byte(strings.Join(d.conf.UserRules, "\n")),
|
Data: []byte(strings.Join(d.conf.UserRules, "\n")),
|
||||||
|
@ -610,7 +610,7 @@ func (d *DNSFilter) enableFiltersLocked(async bool) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var allowFilters []Filter
|
allowFilters := make([]Filter, 0, len(d.conf.WhitelistFilters))
|
||||||
for _, filter := range d.conf.WhitelistFilters {
|
for _, filter := range d.conf.WhitelistFilters {
|
||||||
if !filter.Enabled {
|
if !filter.Enabled {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue