db: don't get print info if the function has over 10000 states
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 6 Feb 2013 08:14:45 +0000 (6 11:14 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Wed, 6 Feb 2013 08:14:45 +0000 (6 11:14 +0300)
It's too much information, just bail.  (Also it probably means that
something has gone wrong).

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_db.c

index f32a463..964669c 100644 (file)
@@ -607,6 +607,7 @@ static void call_return_state_hooks(struct expression *expr)
        struct state_list *slist;
        struct range_list *rl;
        char *return_ranges;
+       int nr_states;
 
        expr = strip_expr(expr);
 
@@ -627,8 +628,12 @@ static void call_return_state_hooks(struct expression *expr)
 
        return_id++;
        slist = __get_cur_slist();
+       nr_states = ptr_list_size((struct ptr_list *)__get_cur_slist());
        FOR_EACH_PTR(returned_state_callbacks, cb) {
-               cb->callback(return_id, return_ranges, expr, slist);
+               if (nr_states < 10000)
+                       cb->callback(return_id, return_ranges, expr, slist);
+               else
+                       cb->callback(return_id, return_ranges, expr, NULL);
        } END_FOR_EACH_PTR(cb);
 }