perlcritic: each() called at line 752, column 35. The each function may cause undefined behavior when operating on the hash while iterating. Use a foreach loop over the hash's keys or values instead.
This commit is contained in:
@ -753,7 +753,8 @@ sub checkJobsetWrapped {
|
||||
|
||||
if ($jobsetChanged) {
|
||||
# Create JobsetEvalMembers mappings.
|
||||
while (my ($id, $x) = each %buildMap) {
|
||||
foreach my $id (keys %buildMap) {
|
||||
my $x = $buildMap{$id};
|
||||
$ev->jobsetevalmembers->create({ build => $id, isnew => $x->{new} });
|
||||
}
|
||||
|
||||
@ -762,7 +763,8 @@ sub checkJobsetWrapped {
|
||||
# builds for the same derivation, pick the one with the
|
||||
# shortest name.
|
||||
my %drvPathToId;
|
||||
while (my ($id, $x) = each %buildMap) {
|
||||
foreach my $id (keys %buildMap) {
|
||||
my $x = $buildMap{$id};
|
||||
my $y = $drvPathToId{$x->{drvPath}};
|
||||
if (defined $y) {
|
||||
next if length $x->{jobName} > length $y->{jobName};
|
||||
@ -806,7 +808,8 @@ sub checkJobsetWrapped {
|
||||
|
||||
# Wake up hydra-queue-runner.
|
||||
my $lowestId;
|
||||
while (my ($id, $x) = each %buildMap) {
|
||||
foreach my $id (keys %buildMap) {
|
||||
my $x = $buildMap{$id};
|
||||
$lowestId = $id if $x->{new} && (!defined $lowestId || $id < $lowestId);
|
||||
}
|
||||
$notifyAdded->execute($lowestId) if defined $lowestId;
|
||||
|
Reference in New Issue
Block a user