1

micro optimization for big lists

This commit is contained in:
eleksir
2016-10-15 14:52:21 +03:00
parent e3f657c7f6
commit 73f7997dbf

View File

@@ -25,7 +25,7 @@ my $help = 'Usage:
/notify show - shows whitelists and their statuses /notify show - shows whitelists and their statuses
'; ';
register($script_name, '0.8.1', 'Sends *nix desktop notifications', \&freehooks); register($script_name, '0.8.2', 'Sends *nix desktop notifications', \&freehooks);
HexChat::print("$script_name loaded\n"); HexChat::print("$script_name loaded\n");
my @hooks; my @hooks;
@@ -59,7 +59,11 @@ sub hookfn {
foreach (@nicklist) { foreach (@nicklist) {
next unless(defined($_)); next unless(defined($_));
next if($_ eq ''); next if($_ eq '');
$flag = 1 if ($_ eq $nick);
if ($_ eq $nick) {
$flag = 1;
last;
}
} }
} }
@@ -69,7 +73,11 @@ sub hookfn {
foreach (@chanlist) { foreach (@chanlist) {
next unless(defined($_)); next unless(defined($_));
next if($_ eq ''); next if($_ eq '');
$flag = 1 if ($_ eq $channel);
if ($_ eq $channel) {
$flag = 1;
last;
}
} }
} }
@@ -79,7 +87,11 @@ sub hookfn {
foreach (@netlist) { foreach (@netlist) {
next unless(defined($_)); next unless(defined($_));
next if($_ eq ''); next if($_ eq '');
$flag = 1 if ($_ eq $network);
if ($_ eq $network){
$flag = 1;
last;
}
} }
} }