bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 8/8] Avoid some false positives for the sc_prohibit_doubled_word


From: James Youngman
Subject: [PATCH 8/8] Avoid some false positives for the sc_prohibit_doubled_word check.
Date: Sun, 5 Jun 2011 01:11:57 +0100

* .x-sc_prohibit_doubled_word: don't perform this check on
xargs/testsuite/xargs.sysv/iquotes.xo or ChangeLog.
* find/tree.c: Modify some text to avoid saying "AND and",
which one of the syntax checks doesn't like.
(opt_expr): Likewise.
(consider_arm_swap): Likewise.
* README: Likewise.
---
 .x-sc_prohibit_doubled_word |    2 ++
 ChangeLog                   |    9 +++++++++
 README                      |    8 ++++----
 doc/find.texi               |    4 ++--
 find/tree.c                 |   23 ++++++++++++-----------
 5 files changed, 29 insertions(+), 17 deletions(-)
 create mode 100644 .x-sc_prohibit_doubled_word

diff --git a/.x-sc_prohibit_doubled_word b/.x-sc_prohibit_doubled_word
new file mode 100644
index 0000000..9d71e2d
--- /dev/null
+++ b/.x-sc_prohibit_doubled_word
@@ -0,0 +1,2 @@
+xargs/testsuite/xargs\.sysv/iquotes\.xo
+ChangeLog
diff --git a/ChangeLog b/ChangeLog
index 1e65808..e366aa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2011-06-05  James Youngman  <address@hidden>
 
+       Avoid some false positives for the sc_prohibit_doubled_word check.
+       * .x-sc_prohibit_doubled_word: don't perform this check on
+       xargs/testsuite/xargs.sysv/iquotes.xo or ChangeLog.
+       * find/tree.c: Modify some text to avoid saying "AND and",
+       which one of the syntax checks doesn't like.
+       (opt_expr): Likewise.
+       (consider_arm_swap): Likewise.
+       * README: Likewise.
+
        Include dirent.h uncontintionally (since gnulib provides it).
        * find/pred.c: Include <dirent.h> unconditionally; gnulib provides
        it.
diff --git a/README b/README
index ec5d312..4671dcc 100644
--- a/README
+++ b/README
@@ -49,10 +49,10 @@ It does this by:
 1. Checking the number of links to directories and not statting files
 that it knows aren't directories until it encounters a test or action
 that needs the stat info.
-2.  Rearranging the command line, where possible, so that it can do tests
-that don't require a stat before tests that do, in hopes that the
-latter will be skipped because of an OR or AND.  (But it only does
-this where it will leave the output unchanged.)
+2.  Rearranging the command line, where possible, so that it can do
+tests that don't require a stat before tests that do, in hopes that
+the latter will be skipped because of a -o/-a conjunction.  (But it
+only does this where it will leave the output unchanged.)
 
 The locate program and its helper programs are derived (heavily
 modified) from James Woods' public domain fast-find code, which is
diff --git a/doc/find.texi b/doc/find.texi
index 70ff60f..017ed91 100644
--- a/doc/find.texi
+++ b/doc/find.texi
@@ -1486,14 +1486,14 @@ protect the @samp{!} from shell interpretation by 
quoting it.
 @item @address@hidden expr2}}
 @itemx @address@hidden -a @var{expr2}}
 @itemx @address@hidden -and @var{expr2}}
address@hidden -a
 @findex -and
address@hidden -a
 And; @var{expr2} is not evaluated if @var{expr1} is false.
 
 @item @address@hidden -o @var{expr2}}
 @itemx @address@hidden -or @var{expr2}}
address@hidden -o
 @findex -or
address@hidden -o
 Or; @var{expr2} is not evaluated if @var{expr1} is true.
 
 @item @address@hidden , @var{expr2}}
diff --git a/find/tree.c b/find/tree.c
index 389b2fc..4bfd77c 100644
--- a/find/tree.c
+++ b/find/tree.c
@@ -584,18 +584,18 @@ consider_arm_swap (struct predicate *p)
            {
              want_swap = succ_rate_r < succ_rate_l;
              if (!want_swap)
-               reason = "Operation is OR and right success rate >= left";
+               reason = "Operation is OR; right success rate >= left";
            }
          else if (pred_is (p, pred_and))
            {
              want_swap = succ_rate_r > succ_rate_l;
              if (!want_swap)
-               reason = "Operation is AND and right success rate <= left";
+               reason = "Operation is AND; right success rate <= left";
            }
          else
            {
              want_swap = false;
-             reason = "Not AND or OR";
+             reason = "Not 'AND' or 'OR'";
            }
        }
       else
@@ -672,10 +672,10 @@ do_arm_swaps (struct predicate *p)
      tests likely to succeed at the front of the list.  For AND, we
      prefer tests likely to fail at the front of the list.
 
-     This routine "normalizes" the predicate tree by ensuring that
-     all expression predicates have AND (or OR or COMMA) parent nodes
-     which are linked along the left edge of the expression tree.
-     This makes manipulation of subtrees easier.
+     This routine "normalizes" the predicate tree by ensuring that all
+     expression predicates have 'AND' (or 'OR' or 'COMMA') parent
+     nodes which are linked along the left edge of the expression
+     tree.  This makes manipulation of subtrees easier.
 
      EVAL_TREEP points to the root pointer of the predicate tree
      to be rearranged.  opt_expr may return a new root pointer there.
@@ -815,8 +815,9 @@ opt_expr (struct predicate **eval_treep)
          break;
 
        case BI_OP:
-         /* For nested AND or OR, recurse (AND/OR form layers on the left of
-            the tree), and continue scanning this level of AND or OR. */
+         /* For nested 'AND' or 'OR', recurse (AND/OR form layers on
+            the left of the tree), and continue scanning this level
+            of 'AND' or 'OR'. */
          curr->pred_right->side_effects = opt_expr (&curr->pred_right);
          break;
 
@@ -1220,8 +1221,8 @@ calculate_derived_rates (struct predicate *p)
 }
 
 /* opt_expr() rearranges predicates such that each left subtree is
- * rooted at a logical predicate (e.g. and or or).  check_normalization()
- * asserts that this property still holds.
+ * rooted at a logical predicate (e.g. '-a' or '-o').
+ * check_normalization() asserts that this property still holds.
  *
  */
 static void
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]