param_limit/filter: ignore whole ranges
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 15 Apr 2013 09:12:02 +0000 (15 12:12 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Wed, 17 Apr 2013 08:38:08 +0000 (17 11:38 +0300)
Limiting or filtering a parameter to "anything" is not a useful limit.  We
can just ignore it.

Printing it out is a lot of data to print and then when we read it and
parse it, that causes a slow down as well.

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

index 58d1845..39a30ac 100644 (file)
@@ -93,7 +93,7 @@ static const char *get_param_name(struct sm_state *sm)
        return NULL;
 }
 
-static char *get_orig_rl(struct sm_state *sm)
+static struct range_list *get_orig_rl(struct sm_state *sm)
 {
        struct range_list *ret = NULL;
        struct sm_state *tmp;
@@ -109,24 +109,24 @@ static char *get_orig_rl(struct sm_state *sm)
                }
                ret = rl_union(ret, estate_rl(extra));
        } END_FOR_EACH_PTR(tmp);
-       return show_rl(ret);
+       return ret;
 }
 
 static void print_one_mod_param(int return_id, char *return_ranges,
                        int param, struct sm_state *sm, struct state_list *slist)
 {
        const char *param_name;
-       char *filter;
+       struct range_list *rl;
 
        param_name = get_param_name(sm);
        if (!param_name)
                return;
-       filter = get_orig_rl(sm);
-       if (!filter)
+       rl = get_orig_rl(sm);
+       if (is_whole_rl(rl))
                return;
 
        sql_insert_return_states(return_id, return_ranges, FILTER_VALUE, param,
-                       param_name, filter);
+                       param_name, show_rl(rl));
 }
 
 static void print_one_extra_param(int return_id, char *return_ranges,
@@ -135,6 +135,8 @@ static void print_one_extra_param(int return_id, char *return_ranges,
        struct smatch_state *old;
        const char *param_name;
 
+       if (estate_is_whole(sm->state))
+               return;
        old = get_state_slist(start_states, SMATCH_EXTRA, sm->name, sm->sym);
        if (old && estates_equiv(old, sm->state))
                return;
index 2071742..a0b6420 100644 (file)
@@ -114,6 +114,8 @@ static void print_return_value_param(int return_id, char *return_ranges, struct
                if (!my_sm) {
                        struct smatch_state *old;
 
+                       if (estate_is_whole(tmp->state))
+                               continue;
                        old = get_state_slist(start_states, SMATCH_EXTRA, tmp->name, tmp->sym);
                        if (old && estates_equiv(old, tmp->state))
                                continue;
@@ -129,6 +131,8 @@ static void print_return_value_param(int return_id, char *return_ranges, struct
                /* This represents an impossible state.  I screwd up.  Bail. */
                if (!estate_rl(state))
                        continue;
+               if (estate_is_whole(state))
+                       continue;
                sql_insert_return_states(return_id, return_ranges,
                                        LIMITED_VALUE, param, "$$",
                                        state->name);