Index: ChangeLog from Raja R Harinath * lib/Automake/Condition.pm (strip): Replace loop with 'grep'. (not): Replace loop with 'map'. * lib/Automake/DisjConditions.pm (sub_conditions): Likewise. * lib/Automake/Item.pm (not_alwasy_defined_in_cond): Don't 'simplify' result of 'invert', since it's already in canonical form. * lib/Automake/Rule.pm (define): Replace loop with 'not_always_defined_in_cond'. Index: lib/Automake/Condition.pm =================================================================== RCS file: /cvs/automake/automake/lib/Automake/Condition.pm,v retrieving revision 1.3 diff -u -p -u -r1.3 Condition.pm --- lib/Automake/Condition.pm 30 Mar 2003 01:56:28 -0000 1.3 +++ lib/Automake/Condition.pm 12 Aug 2003 22:34:31 -0000 @@ -251,11 +251,7 @@ except those of C<$minuscond>. This is sub strip ($$) { my ($self, $minus) = @_; - my @res; - foreach my $cond ($self->conds) - { - push @res, $cond unless $minus->has ($cond); - } + my @res = grep { not $minus->has ($_) } $self->conds; return new Automake::Condition @res; } @@ -486,11 +482,8 @@ sub not ($ ) { my ($self) = @_; return @{$self->{'not'}} if defined $self->{'not'}; - my @res; - for my $cond ($self->conds) - { - push @res, new Automake::Condition &conditional_negate ($cond); - } + my @res = + map { new Automake::Condition &conditional_negate ($_) } $self->conds; $self->{'not'} = address@hidden; return @res; } Index: lib/Automake/DisjConditions.pm =================================================================== RCS file: /cvs/automake/automake/lib/Automake/DisjConditions.pm,v retrieving revision 1.9 diff -u -p -u -r1.9 DisjConditions.pm --- lib/Automake/DisjConditions.pm 12 Aug 2003 22:33:44 -0000 1.9 +++ lib/Automake/DisjConditions.pm 12 Aug 2003 22:34:31 -0000 @@ -433,11 +433,8 @@ sub sub_conditions ($$) my @prodconds = $subcond->multiply ($self->conds); # Now, strip $subcond from the remaining (i.e., non-false) Conditions. - my @res; - foreach my $c (@prodconds) - { - push @res, $c->strip ($subcond) unless $c->false; - } + my @res = map { $_->false ? () : $_->strip ($subcond) } @prodconds; + return new Automake::DisjConditions @res; } Index: lib/Automake/Item.pm =================================================================== RCS file: /cvs/automake/automake/lib/Automake/Item.pm,v retrieving revision 1.1 diff -u -p -u -r1.1 Item.pm --- lib/Automake/Item.pm 12 Aug 2003 17:52:09 -0000 1.1 +++ lib/Automake/Item.pm 12 Aug 2003 22:34:31 -0000 @@ -180,8 +180,7 @@ sub not_always_defined_in_cond ($$) $self->conditions ->sub_conditions ($cond) ->invert - ->simplify - ->multiply ($cond); + ->multiply ($cond); } Index: lib/Automake/Rule.pm =================================================================== RCS file: /cvs/automake/automake/lib/Automake/Rule.pm,v retrieving revision 1.2 diff -u -p -u -r1.2 Rule.pm --- lib/Automake/Rule.pm 12 Aug 2003 22:33:44 -0000 1.2 +++ lib/Automake/Rule.pm 12 Aug 2003 22:34:31 -0000 @@ -740,11 +740,8 @@ sub define ($$$$$) # was already defined in condition COND1 and we want to define # it in condition TRUE, then define it only in condition !COND1. # (See cond14.test and cond15.test for some test cases.) - @conds = (); - for my $undefined_cond ($rule->conditions->invert->conds) - { - push @conds, $cond->merge ($undefined_cond); - } + @conds = $rule->not_always_defined_in_cond ($cond)->conds; + # No conditions left to define the rule. # Warn, because our workaround is meaningless in this case. if (scalar @conds == 0)