From 35f1744fe3f9f9f22af028f92a88fb05607034eb Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 24 Jul 2018 15:38:45 +0300 Subject: [PATCH] conditions: don't parse NULLs This change doesn't matter... But don't parse NULLs. It probably doesn't slow things down at all to parse NULLs but I thought it might so I wrote this code and now I am committing it... But I seriously doubt it makes a difference. Signed-off-by: Dan Carpenter --- smatch_conditions.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/smatch_conditions.c b/smatch_conditions.c index c98c3ded..79f89bdd 100644 --- a/smatch_conditions.c +++ b/smatch_conditions.c @@ -75,14 +75,17 @@ static int is_logical_and(struct expression *expr) static int handle_zero_comparisons(struct expression *expr) { struct expression *tmp = NULL; + struct expression *zero; // if left is zero or right is zero if (is_zero(expr->left)) { - if (expr->left->type != EXPR_VALUE) + zero = strip_expr(expr->left); + if (zero->type != EXPR_VALUE) __split_expr(expr->left); tmp = expr->right; } else if (is_zero(expr->right)) { - if (expr->right->type != EXPR_VALUE) + zero = strip_expr(expr->left); + if (zero->type != EXPR_VALUE) __split_expr(expr->right); tmp = expr->left; } else { -- 2.11.4.GIT