From e10af87d8b297e2848ea8d75562dda0d2b054e2a Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 22 Feb 2021 15:00:53 +0300 Subject: [PATCH] avl: short cut FOR_EACH_MY_SM() for checks without and states If a check has not states, then we shouldn't have to iterate through the all the states. Signed-off-by: Dan Carpenter --- avl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/avl.h b/avl.h index 50c90cda..be598d7d 100644 --- a/avl.h +++ b/avl.h @@ -92,8 +92,11 @@ bool avl_check_invariants(struct stree *avl); #define END_FOR_EACH_SM(_sm) }} #define FOR_EACH_MY_SM(_owner, avl, _sm) { \ + bool __has_state = has_states(_owner); \ AvlIter _i; \ avl_foreach(_i, avl) { \ + if (!__has_state) \ + break; \ _sm = _i.sm; \ if (_sm->owner != _owner) \ continue; \ -- 2.11.4.GIT