]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* lib/Automake/Condition.pm (strip): Replace loop with 'grep'.
authorRaja R Harinath <harinath@acm.org>
Tue, 12 Aug 2003 23:32:59 +0000 (23:32 +0000)
committerRaja R Harinath <harinath@acm.org>
Tue, 12 Aug 2003 23:32:59 +0000 (23:32 +0000)
(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'.

ChangeLog
lib/Automake/Condition.pm
lib/Automake/DisjConditions.pm
lib/Automake/Item.pm
lib/Automake/Rule.pm

index c80fe4ef60b9986d0e93fa19b53e46bcc81c85b2..39cf3d38b7ae2a69b0860fbca117e80842d358cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2003-08-12  Raja R Harinath  <harinath@acm.org>
 
+       * 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.
index a9a3cb600d8816da91137fa1f7131995a4685dde..34f443efb13d238f46596925178f5f107c11e408 100644 (file)
@@ -251,11 +251,7 @@ except those of C<$minuscond>.  This is the opposite of C<merge>.
 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;
 }
index e5743f5518792d7b827f476883dc96edae26f7f5..9204b76bf31cc51d5eccfa5ddcecbe3ef063dd57 100644 (file)
@@ -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 f95154c83e96c511f6fb0c29af3cee6d4fc2c10e..02ea8dea77e54e4ce0cc6c926823b0f118548fdb 100644 (file)
@@ -180,8 +180,7 @@ sub not_always_defined_in_cond ($$)
     $self->conditions
       ->sub_conditions ($cond)
        ->invert
-         ->simplify
-           ->multiply ($cond);
+         ->multiply ($cond);
 }
 
 
index 4bef2b4cb869aba570f64c2e970d02f3da229503..fd6471d4519f72c7519b1d524f48c5fe2ab68ca6 100644 (file)
@@ -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)