* filter: speed up parsing

This commit is contained in:
Simon Zolin 2019-10-07 19:18:30 +03:00
parent 37fe3c148f
commit 3b9b37dde7
1 changed files with 3 additions and 4 deletions

View File

@ -312,15 +312,14 @@ func isPrintableText(data []byte) bool {
// A helper function that parses filter contents and returns a number of rules and a filter name (if there's any)
func parseFilterContents(contents []byte) (int, string) {
lines := strings.Split(string(contents), "\n")
data := string(contents)
rulesCount := 0
name := ""
seenTitle := false
// Count lines in the filter
for _, line := range lines {
line = strings.TrimSpace(line)
for len(data) != 0 {
line := SplitNext(&data, '\n')
if len(line) == 0 {
continue
}