geen onnodige moves maken....

This commit is contained in:
Ward Wouts 2002-01-20 11:34:44 +00:00
parent 3aa5c14d17
commit 56472b9ea3

View file

@ -170,16 +170,21 @@ sub check_unique (@target_list){
# Returns an array of unsafe line numbers
sub check_safety {
my ($from, $to) = @_;
my ($i, $j, @danger);
my ($i, $j, @danger, @unique, %seen);
my ($a, $b);
for ( $i=0 ; $i < scalar(@$from) ; $i++ ) {
for ( $j=0; $j < scalar(@$to); $j++ ) {
if ((chomp($from->[$i]) eq chomp($to->[$j])) && ($i != $j)) {
$a = $from->[$i]; chomp($a);
$b = $to->[$j]; chomp($b);
if (($a eq $b) && ($i != $j)) {
push @danger, $i;
push @danger, $j;
}
}
}
return @danger;
%seen = ();
@unique = grep { ! $seen{$_} ++ } @danger;
return @unique;
}
# generate random filename, which does not exist