summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-02-21 18:43:37 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-02-21 18:43:37 -0500
commita1aca80e0dc5cf0fcb7b467dd469c639353f19d6 (patch)
treefc5ab6a939e07d96093459f704b1e11a8744e910 /parse.c
parenteb3af1b4ab071e7e3a1f01a3f62390f976592e06 (diff)
downloadbfs-a1aca80e0dc5cf0fcb7b467dd469c639353f19d6.tar.xz
Simplify double-negation.
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 7863154..8376378 100644
--- a/parse.c
+++ b/parse.c
@@ -909,6 +909,11 @@ static struct expr *new_not_expr(struct expr *rhs) {
return &expr_false;
} else if (rhs == &expr_false) {
return &expr_true;
+ } else if (rhs->eval == eval_not) {
+ struct expr *expr = rhs->rhs;
+ rhs->rhs = NULL;
+ free_expr(rhs);
+ return expr;
} else {
return new_unary_expr(eval_not, rhs);
}