From: Dan Carpenter Date: Mon, 4 Feb 2013 08:22:43 +0000 (+0300) Subject: db: print less --info for a few problematic functions X-Git-Tag: 1.57~16 X-Git-Url: https://repo.or.cz/w/smatch.git/commitdiff_plain/1a429ed1cb1ffd8d100e5669c3ad44d628d0e735 db: print less --info for a few problematic functions There are a couple functions where we are tracking a ton of values. Mostly these are functions which have some big structs and maybe those structs have pointers to other structs. It ends up taking a long time to print the information on the --info run. What this does is that when we hit the: return ret; Just print the combined information instead of trying to break it down and printing a copy of for every value of ret. It means that instead of 2000 values out six times we just print 2000 values one time. Signed-off-by: Dan Carpenter --- diff --git a/smatch_db.c b/smatch_db.c index 175bd585..f32a463c 100644 --- a/smatch_db.c +++ b/smatch_db.c @@ -563,13 +563,18 @@ static int call_return_state_hooks_split_possible(struct expression *expr) struct sm_state *sm; struct sm_state *tmp; int ret = 0; + int nr_possible, nr_states; sm = get_sm_state_expr(SMATCH_EXTRA, expr); if (!sm || !sm->merged) return 0; /* bail if it gets too complicated */ - if (ptr_list_size((struct ptr_list *)sm->possible) >= 100) + nr_possible = ptr_list_size((struct ptr_list *)sm->possible); + nr_states = ptr_list_size((struct ptr_list *)__get_cur_slist()); + if (nr_possible >= 100) + return 0; + if (nr_states * nr_possible >= 1000) return 0; FOR_EACH_PTR(sm->possible, tmp) {