From 16e28ee13aa3fcdb72f6d478cca07cd3b7739d0e Mon Sep 17 00:00:00 2001 From: Justin Reichardt Date: Fri, 19 Aug 2022 20:27:53 -0500 Subject: [PATCH] Added removing whitelisted words to removing safewords Again this is to assist with splitting the removing duplicates into multiple go routines --- src/hosts/hosts.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/hosts/hosts.go b/src/hosts/hosts.go index e811213..b12ab90 100644 --- a/src/hosts/hosts.go +++ b/src/hosts/hosts.go @@ -257,9 +257,12 @@ func removeduplicates(siteBuff *[]siteList, whitelist *[]string) { } } - // Removing safewords - log.Print("Checking for safewords") + // Removing safewords and whitelisted words + log.Print("Checking for safewords and whitelisted words") for i,e := range entry { + if (*e.r == true) { + continue + } for _,w := range(safewords) { if *e.s == w { *(entry[i].r) = true @@ -267,6 +270,13 @@ func removeduplicates(siteBuff *[]siteList, whitelist *[]string) { break } } + for _, w := range *whitelist { + if *e.s == w { + *(entry[i].r) = true + c.w++ + break + } + } } // Removing duplicates @@ -276,13 +286,6 @@ func removeduplicates(siteBuff *[]siteList, whitelist *[]string) { if *(entry[i].r) == true { continue } - for _, w := range *whitelist { - if *e.s == w { - *(entry[i].r) = true - c.w++ - break - } - } if *(entry[i].r) == true { continue }