estate: rename estate_ranges() to estate_rl()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 11 Jan 2013 12:15:57 +0000 (11 15:15 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 11 Jan 2013 12:15:57 +0000 (11 15:15 +0300)
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_bool_implications.c
smatch_db.c
smatch_estate.c
smatch_extra.c
smatch_extra.h
smatch_implied.c
smatch_math.c
smatch_param_filter.c
smatch_param_limit.c
smatch_param_set.c

index 9681ea6..2f9d434 100644 (file)
@@ -87,14 +87,13 @@ static void print_implications(struct symbol *sym, int param,
        if (!true_state || !false_state)
                return;
 
-       if (rl_equiv(estate_ranges(true_state),
-                                  estate_ranges(false_state)))
+       if (rl_equiv(estate_rl(true_state), estate_rl(false_state)))
                return;
 
        sm_msg("info: bool_return_implication \"1\" %d \"%s\" %s", param,
-              show_ranges(estate_ranges(true_state)), global_static());
+              show_ranges(estate_rl(true_state)), global_static());
        sm_msg("info: bool_return_implication \"0\" %d \"%s\" %s", param,
-              show_ranges(estate_ranges(false_state)), global_static());
+              show_ranges(estate_rl(false_state)), global_static());
 }
 
 static void cleanup(void)
index 5a2240d..c0dd440 100644 (file)
@@ -581,7 +581,7 @@ static int call_return_state_hooks_split_possible(struct expression *expr)
 
                overwrite_states_using_pool(tmp);
 
-               rl = cast_rl(cur_func_return_type(), estate_ranges(tmp->state));
+               rl = cast_rl(cur_func_return_type(), estate_rl(tmp->state));
                return_ranges = show_ranges(rl);
 
                return_id++;
index 4bc0152..e359df2 100644 (file)
@@ -31,7 +31,7 @@ struct smatch_state *merge_estates(struct smatch_state *s1, struct smatch_state
        if (estates_equiv(s1, s2))
                return s1;
 
-       value_ranges = rl_union(estate_ranges(s1), estate_ranges(s2));
+       value_ranges = rl_union(estate_rl(s1), estate_rl(s2));
        tmp = alloc_estate_rl(value_ranges);
        rlist = get_shared_relations(estate_related(s1), estate_related(s2));
        set_related(tmp, rlist);
@@ -48,7 +48,7 @@ struct data_info *get_dinfo(struct smatch_state *state)
        return (struct data_info *)state->data;
 }
 
-struct range_list *estate_ranges(struct smatch_state *state)
+struct range_list *estate_rl(struct smatch_state *state)
 {
        if (!state)
                return NULL;
@@ -81,25 +81,25 @@ void estate_clear_hard_max(struct smatch_state *state)
 
 int estate_get_hard_max(struct smatch_state *state, sval_t *sval)
 {
-       if (!state || !get_dinfo(state)->hard_max || !estate_ranges(state))
+       if (!state || !get_dinfo(state)->hard_max || !estate_rl(state))
                return 0;
-       *sval = rl_max(estate_ranges(state));
+       *sval = rl_max(estate_rl(state));
        return 1;
 }
 
 sval_t estate_min(struct smatch_state *state)
 {
-       return rl_min(estate_ranges(state));
+       return rl_min(estate_rl(state));
 }
 
 sval_t estate_max(struct smatch_state *state)
 {
-       return rl_max(estate_ranges(state));
+       return rl_max(estate_rl(state));
 }
 
 struct symbol *estate_type(struct smatch_state *state)
 {
-       return rl_max(estate_ranges(state)).type;
+       return rl_max(estate_rl(state)).type;
 }
 
 static int rlists_equiv(struct related_list *one, struct related_list *two)
@@ -140,15 +140,15 @@ int estates_equiv(struct smatch_state *one, struct smatch_state *two)
 
 int estate_is_whole(struct smatch_state *state)
 {
-       return is_whole_rl(estate_ranges(state));
+       return is_whole_rl(estate_rl(state));
 }
 
 int estate_get_single_value(struct smatch_state *state, sval_t *sval)
 {
        sval_t min, max;
 
-       min = rl_min(estate_ranges(state));
-       max = rl_max(estate_ranges(state));
+       min = rl_min(estate_rl(state));
+       max = rl_max(estate_rl(state));
        if (sval_cmp(min, max) != 0)
                return 0;
        *sval = min;
index 194b545..7b3cf70 100644 (file)
@@ -177,7 +177,7 @@ struct smatch_state *filter_range(struct smatch_state *orig,
        if (!orig)
                orig = alloc_estate_whole(filter_min.type);
 
-       rl = remove_range(estate_ranges(orig), filter_min, filter_max);
+       rl = remove_range(estate_rl(orig), filter_min, filter_max);
        return alloc_estate_rl(rl);
 }
 
@@ -538,7 +538,7 @@ static struct smatch_state *increment_state(struct smatch_state *state)
        sval_t min = estate_min(state);
        sval_t max = estate_max(state);
 
-       if (!estate_ranges(state))
+       if (!estate_rl(state))
                return NULL;
 
        if (inside_loop())
@@ -556,7 +556,7 @@ static struct smatch_state *decrement_state(struct smatch_state *state)
        sval_t min = estate_min(state);
        sval_t max = estate_max(state);
 
-       if (!estate_ranges(state))
+       if (!estate_rl(state))
                return NULL;
 
        if (inside_loop())
@@ -1057,7 +1057,7 @@ static void db_param_limit_filter(struct expression *expr, int param, char *key,
        sm = get_sm_state(SMATCH_EXTRA, name, sym);
        type = get_member_type_from_key(arg, key);
        if (sm)
-               rl = estate_ranges(sm->state);
+               rl = estate_rl(sm->state);
        else
                rl = alloc_whole_rl(type);
 
@@ -1065,7 +1065,7 @@ static void db_param_limit_filter(struct expression *expr, int param, char *key,
        new = rl_intersection(rl, limit);
 
        /* We want to preserve the implications here */
-       if (sm && rl_equiv(estate_ranges(sm->state), new))
+       if (sm && rl_equiv(estate_rl(sm->state), new))
                __set_sm(sm);
        else
                set_extra_nomod(name, sym, alloc_estate_rl(new));
@@ -1100,7 +1100,7 @@ static void db_param_add(struct expression *expr, int param, char *key, char *va
        state = get_state(SMATCH_EXTRA, name, sym);
        if (state) {
                str_to_rl(type, value, &added);
-               new = rl_union(estate_ranges(state), added);
+               new = rl_union(estate_rl(state), added);
        } else {
                new = alloc_whole_rl(type);
        }
index 32ce915..3473cd5 100644 (file)
@@ -98,7 +98,7 @@ struct smatch_state *merge_estates(struct smatch_state *s1, struct smatch_state
 int estates_equiv(struct smatch_state *one, struct smatch_state *two);
 int estate_is_whole(struct smatch_state *state);
 
-struct range_list *estate_ranges(struct smatch_state *state);
+struct range_list *estate_rl(struct smatch_state *state);
 struct related_list *estate_related(struct smatch_state *state);
 
 sval_t estate_min(struct smatch_state *state);
index ea1a848..a2875ce 100644 (file)
@@ -152,11 +152,11 @@ static void do_compare(struct sm_state *sm_state, int comparison, struct range_l
        }
 
        if (lr == LEFT) {
-               istrue = !possibly_false_rl(estate_ranges(s->state), comparison, vals);
-               isfalse = !possibly_true_rl(estate_ranges(s->state), comparison, vals);
+               istrue = !possibly_false_rl(estate_rl(s->state), comparison, vals);
+               isfalse = !possibly_true_rl(estate_rl(s->state), comparison, vals);
        } else {
-               istrue = !possibly_false_rl(vals, comparison, estate_ranges(s->state));
-               isfalse = !possibly_true_rl(vals, comparison, estate_ranges(s->state));
+               istrue = !possibly_false_rl(vals, comparison, estate_rl(s->state));
+               isfalse = !possibly_true_rl(vals, comparison, estate_rl(s->state));
        }
 
        print_debug_tf(s, istrue, isfalse);
@@ -555,7 +555,7 @@ struct range_list *__get_implied_values(struct expression *switch_expr)
        state = get_state(SMATCH_EXTRA, name, sym);
        if (!state)
                goto free;
-       ret = clone_rl(estate_ranges(state));
+       ret = clone_rl(estate_rl(state));
 free:
        free_string(name);
        if (!ret) {
index 8262e5e..0f84dcb 100644 (file)
@@ -725,7 +725,7 @@ int get_implied_rl(struct expression *expr, struct range_list **rl)
 
        state = get_state_expr(SMATCH_EXTRA, expr);
        if (state) {
-               *rl = clone_rl(estate_ranges(state));
+               *rl = clone_rl(estate_rl(state));
                return 1;
        }
 
index f4fdf36..6543b97 100644 (file)
@@ -81,7 +81,7 @@ static char *get_orig_rl(struct sm_state *sm)
                        sm_msg("debug: no value found in pool %p", tmp->pool);
                        return NULL;
                }
-               ret = rl_union(ret, estate_ranges(extra));
+               ret = rl_union(ret, estate_rl(extra));
        } END_FOR_EACH_PTR(tmp);
        return show_ranges(ret);
 }
@@ -120,7 +120,7 @@ static void print_one_extra_param(int return_id, char *return_ranges,
 
        sm_msg("info: return_param_filter %d %d '%s' '%s' '%s' %s",
               return_id, param, return_ranges,
-              param_name, show_ranges(estate_ranges(sm->state)), global_static());
+              param_name, show_ranges(estate_rl(sm->state)), global_static());
 }
 
 static void print_return_value_param(int return_id, char *return_ranges, struct expression *expr, struct state_list *slist)
index b9d9cd1..148a9b6 100644 (file)
@@ -50,7 +50,7 @@ static struct smatch_state *filter_my_sm(struct sm_state *sm)
                } else {
                        estate = tmp->state;
                }
-               ret = rl_union(ret, estate_ranges(estate));
+               ret = rl_union(ret, estate_rl(estate));
        } END_FOR_EACH_PTR(tmp);
 
        return alloc_estate_rl(ret);
@@ -88,7 +88,7 @@ static void print_return_value_param(int return_id, char *return_ranges, struct
                if (!state)
                        continue;
                /* This represents an impossible state.  I screwd up.  Bail. */
-               if (!estate_ranges(state))
+               if (!estate_rl(state))
                        continue;
                sm_msg("info: return_param_limit %d %d '%s' '$$' '%s' %s",
                       return_id, param, return_ranges,
index 7980808..21c6b86 100644 (file)
@@ -69,12 +69,12 @@ static void print_return_value_param(int return_id, char *return_ranges, struct
        my_slist = get_all_states_slist(my_id, slist);
 
        FOR_EACH_PTR(my_slist, sm) {
-               if (!estate_ranges(sm->state))
+               if (!estate_rl(sm->state))
                        continue;
                extra = get_state_slist(slist, SMATCH_EXTRA, sm->name, sm->sym);
-               if (!estate_ranges(extra))
+               if (!estate_rl(extra))
                        continue;
-               rl = rl_intersection(estate_ranges(sm->state), estate_ranges(extra));
+               rl = rl_intersection(estate_rl(sm->state), estate_rl(extra));
                if (!rl)
                        continue;