* filter: speed up parsing
This commit is contained in:
parent
37fe3c148f
commit
3b9b37dde7
|
@ -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)
|
// 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) {
|
func parseFilterContents(contents []byte) (int, string) {
|
||||||
lines := strings.Split(string(contents), "\n")
|
data := string(contents)
|
||||||
rulesCount := 0
|
rulesCount := 0
|
||||||
name := ""
|
name := ""
|
||||||
seenTitle := false
|
seenTitle := false
|
||||||
|
|
||||||
// Count lines in the filter
|
// Count lines in the filter
|
||||||
for _, line := range lines {
|
for len(data) != 0 {
|
||||||
|
line := SplitNext(&data, '\n')
|
||||||
line = strings.TrimSpace(line)
|
|
||||||
if len(line) == 0 {
|
if len(line) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue