From 8f81249b3c2f1aa6d2b3133ae7ba7d5099c8fbbd Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 6 May 2020 17:50:21 +0300 Subject: [PATCH] bits: move is_loop_iterator() earlier This just shuffles code around and doesn't change it. Signed-off-by: Dan Carpenter --- smatch_bits.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/smatch_bits.c b/smatch_bits.c index 2fcd5e8f..21aa0775 100644 --- a/smatch_bits.c +++ b/smatch_bits.c @@ -111,6 +111,23 @@ static struct smatch_state *unmatched_state(struct sm_state *sm) return alloc_bstate(0, possible); } +static bool is_loop_iterator(struct expression *expr) +{ + struct statement *pre_stmt, *loop_stmt; + + pre_stmt = expr_get_parent_stmt(expr); + if (!pre_stmt || pre_stmt->type != STMT_EXPRESSION) + return false; + + loop_stmt = stmt_get_parent_stmt(pre_stmt); + if (!loop_stmt || loop_stmt->type != STMT_ITERATOR) + return false; + if (loop_stmt->iterator_pre_statement != pre_stmt) + return false; + + return true; +} + static void match_modify(struct sm_state *sm, struct expression *mod_expr) { // FIXME: we really need to store the type @@ -283,23 +300,6 @@ static void match_compare(struct expression *expr) (expr->op == SPECIAL_EQUAL) ? NULL : alloc_bstate(val.uvalue, val.uvalue)); } -static bool is_loop_iterator(struct expression *expr) -{ - struct statement *pre_stmt, *loop_stmt; - - pre_stmt = expr_get_parent_stmt(expr); - if (!pre_stmt || pre_stmt->type != STMT_EXPRESSION) - return false; - - loop_stmt = stmt_get_parent_stmt(pre_stmt); - if (!loop_stmt || loop_stmt->type != STMT_ITERATOR) - return false; - if (loop_stmt->iterator_pre_statement != pre_stmt) - return false; - - return true; -} - static void match_assign(struct expression *expr) { struct bit_info *binfo; -- 2.11.4.GIT