change: dn to name in methods log parser

This commit is contained in:
Inanc Gumus
2019-04-25 15:39:11 +03:00
parent 1f7af85519
commit 0e7738454b

View File

@ -69,8 +69,8 @@ func (p *parser) iterator() (next func() bool, cur func() domain) {
cur = func() domain { cur = func() domain {
// return a copy so the caller cannot change it // return a copy so the caller cannot change it
dn := p.domains[last-1] name := p.domains[last-1]
return p.sum[dn] return p.sum[name]
} }
return return
@ -113,14 +113,14 @@ func (p *parser) parse(line string) (dom domain, err error) {
// //
// WRITE METHOD // WRITE METHOD
func (p *parser) push(d domain) { func (p *parser) push(d domain) {
dn := d.name name := d.name
// collect the unique domains // collect the unique domains
if _, ok := p.sum[dn]; !ok { if _, ok := p.sum[name]; !ok {
p.domains = append(p.domains, dn) p.domains = append(p.domains, name)
} }
p.total += d.visits p.total += d.visits
d.visits += p.sum[dn].visits d.visits += p.sum[name].visits
p.sum[dn] = d p.sum[name] = d
} }