From: Raja R Harinath Date: Tue, 12 Aug 2003 23:32:59 +0000 (+0000) Subject: * lib/Automake/Condition.pm (strip): Replace loop with 'grep'. X-Git-Tag: Release-1-7b~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=206ac50a2a2a6a66b090eba7a32c667caf821add;p=thirdparty%2Fautomake.git * 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'. --- diff --git a/ChangeLog b/ChangeLog index c80fe4ef6..39cf3d38b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2003-08-12 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'. + * lib/Automake/DisjConditions.pm (ambiguous_p): Typo in comment. * lib/Automake/Rule.pm (accept_extensions, msg_cond_rule): Likewise. (define): Reword comment slightly. diff --git a/lib/Automake/Condition.pm b/lib/Automake/Condition.pm index a9a3cb600..34f443efb 100644 --- a/lib/Automake/Condition.pm +++ b/lib/Automake/Condition.pm @@ -251,11 +251,7 @@ except those of C<$minuscond>. This is the opposite of C. 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'} = [@res]; return @res; } diff --git a/lib/Automake/DisjConditions.pm b/lib/Automake/DisjConditions.pm index e5743f551..9204b76bf 100644 --- a/lib/Automake/DisjConditions.pm +++ b/lib/Automake/DisjConditions.pm @@ -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; } diff --git a/lib/Automake/Item.pm b/lib/Automake/Item.pm index f95154c83..02ea8dea7 100644 --- a/lib/Automake/Item.pm +++ b/lib/Automake/Item.pm @@ -180,8 +180,7 @@ sub not_always_defined_in_cond ($$) $self->conditions ->sub_conditions ($cond) ->invert - ->simplify - ->multiply ($cond); + ->multiply ($cond); } diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index 4bef2b4cb..fd6471d45 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -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)