Skip to content

Commit 8fae11a

Browse files
committed
genblock: no need to use a hashref for redundant domains
1 parent 38f7da8 commit 8fae11a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

genblock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ sub is_domain {
112112
# Therefore, we can delete advertising.bad-actor.com from the hash.
113113
sub reduce_domains {
114114
my $hashref = shift or return;
115-
my $redundant_domains_hashref;
115+
my %redundant_domains;
116116

117117
while ( my $domain = each %$hashref ) {
118118
## Start with the root domain.
@@ -123,16 +123,16 @@ sub reduce_domains {
123123

124124
if ( defined $hashref->{$leaf} ) {
125125
delete $hashref->{$domain};
126-
$redundant_domains_hashref->{$domain} = $leaf;
126+
$redundant_domains{$domain} = $leaf;
127127
last;
128128
}
129129

130130
$index = rindex($domain, '.', $index - 1);
131131
}
132132
}
133133
wantarray
134-
? return %$redundant_domains_hashref
135-
: return $redundant_domains_hashref;
134+
? return %redundant_domains
135+
: return \%redundant_domains;
136136
}
137137

138138
sub unique_domains {

0 commit comments

Comments
 (0)