summaryrefslogtreecommitdiffstats
path: root/bfs.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-21 15:20:01 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-21 15:20:01 -0500
commit43b4eb6c4318de43b163a3b5cae152ad2620d124 (patch)
treeae6ffe61e83126c51c0140b9b034a83d3c5e1a72 /bfs.h
parentb2c2c65fbec390c9e5550b0cea6edcaf986ececc (diff)
downloadbfs-43b4eb6c4318de43b163a3b5cae152ad2620d124.tar.xz
Make optimizations based on the purity of predicates.
This allows something like $ ./bfs -empty -false to avoid evaluating -empty, just like find.
Diffstat (limited to 'bfs.h')
-rw-r--r--bfs.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/bfs.h b/bfs.h
index c9b248d..b365a53 100644
--- a/bfs.h
+++ b/bfs.h
@@ -111,12 +111,13 @@ enum timeunit {
};
struct expr {
+ /** The function that evaluates this expression. */
+ eval_fn *eval;
+
/** The left hand side of the expression. */
struct expr *lhs;
/** The right hand side of the expression. */
struct expr *rhs;
- /** The function that evaluates this expression. */
- eval_fn *eval;
/** The optional comparison flag. */
enum cmpflag cmp;
@@ -138,6 +139,9 @@ struct expr {
/** Optional string data for this expression. */
const char *sdata;
+
+ /** Whether this expression has no side effects. */
+ bool pure;
};
/**