From 8bb577ee5c68dd3c86484e57aa828f5842b71cbc Mon Sep 17 00:00:00 2001 From: Justin Reichardt Date: Fri, 19 Aug 2022 20:20:16 -0500 Subject: [PATCH] Seperated removing safewords and regular words This will help when setting up for splitting the duplicate check into go routines --- src/hosts/hosts.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/hosts/hosts.go b/src/hosts/hosts.go index 61f77dc..e811213 100644 --- a/src/hosts/hosts.go +++ b/src/hosts/hosts.go @@ -239,7 +239,6 @@ func removeduplicates(siteBuff *[]siteList, whitelist *[]string) { c.s = 0 c.w = 0 - log.Print("Checking for duplicates") var entry []struct { r *bool s *string @@ -258,16 +257,22 @@ func removeduplicates(siteBuff *[]siteList, whitelist *[]string) { } } - // Remove safewords and duplicates - lenEntry := len(entry) - for i, e := range entry { - for _, w := range safewords { + // Removing safewords + log.Print("Checking for safewords") + for i,e := range entry { + for _,w := range(safewords) { if *e.s == w { *(entry[i].r) = true c.s++ break } } + } + + // Removing duplicates + log.Print("Checking for duplicates") + lenEntry := len(entry) + for i, e := range entry { if *(entry[i].r) == true { continue }