estate: rename extra_undefined() to alloc_estate_whole()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 11 Jan 2013 12:10:22 +0000 (11 15:10 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 11 Jan 2013 12:10:22 +0000 (11 15:10 +0300)
In the olden times this used to be a special state that wasn't dynamically
allocated.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_constraints.c
smatch_estate.c
smatch_extra.c
smatch_extra.h
smatch_function_hooks.c

index 7d2d28f..fb28290 100644 (file)
@@ -248,7 +248,7 @@ void set_equiv(struct expression *left, struct expression *right)
 
        right_sm = get_sm_state_expr(SMATCH_EXTRA, right);
        if (!right_sm)
-               right_sm = set_state_expr(SMATCH_EXTRA, right, extra_undefined(get_type(right)));
+               right_sm = set_state_expr(SMATCH_EXTRA, right, alloc_estate_whole(get_type(right)));
        if (!right_sm)
                goto free;
 
index a3df00a..14cac1e 100644 (file)
@@ -213,7 +213,7 @@ struct smatch_state *alloc_estate_empty(void)
        return state;
 }
 
-struct smatch_state *extra_undefined(struct symbol *type)
+struct smatch_state *alloc_estate_whole(struct symbol *type)
 {
        return alloc_estate_rl(alloc_whole_rl(type));
 }
index d6049fb..d341ed8 100644 (file)
@@ -175,7 +175,7 @@ struct smatch_state *filter_range(struct smatch_state *orig,
        struct range_list *rl;
 
        if (!orig)
-               orig = extra_undefined(filter_min.type);
+               orig = alloc_estate_whole(filter_min.type);
 
        rl = remove_range(estate_ranges(orig), filter_min, filter_max);
        return alloc_estate_rl(rl);
@@ -416,7 +416,7 @@ static struct smatch_state *unmatched_state(struct sm_state *sm)
                if (state)
                        return state;
        }
-       return extra_undefined(estate_type(sm->state));
+       return alloc_estate_whole(estate_type(sm->state));
 }
 
 static void match_function_call(struct expression *expr)
@@ -428,7 +428,7 @@ static void match_function_call(struct expression *expr)
                tmp = strip_expr(arg);
                if (tmp->type == EXPR_PREOP && tmp->op == '&') {
                        remove_from_equiv_expr(tmp->unop);
-                       set_state_expr(SMATCH_EXTRA, tmp->unop, extra_undefined(get_type(tmp->unop)));
+                       set_state_expr(SMATCH_EXTRA, tmp->unop, alloc_estate_whole(get_type(tmp->unop)));
                }
        } END_FOR_EACH_PTR(arg);
 }
@@ -530,7 +530,7 @@ free:
 
 static void reset_struct_members(struct sm_state *sm)
 {
-       set_extra_mod(sm->name, sm->sym, extra_undefined(estate_type(sm->state)));
+       set_extra_mod(sm->name, sm->sym, alloc_estate_whole(estate_type(sm->state)));
 }
 
 static struct smatch_state *increment_state(struct smatch_state *state)
@@ -581,14 +581,14 @@ static void unop_expr(struct expression *expr)
                state = get_state_expr(SMATCH_EXTRA, expr->unop);
                state = increment_state(state);
                if (!state)
-                       state = extra_undefined(get_type(expr));
+                       state = alloc_estate_whole(get_type(expr));
                set_extra_expr_mod(expr->unop, state);
                break;
        case SPECIAL_DECREMENT:
                state = get_state_expr(SMATCH_EXTRA, expr->unop);
                state = decrement_state(state);
                if (!state)
-                       state = extra_undefined(get_type(expr));
+                       state = alloc_estate_whole(get_type(expr));
                set_extra_expr_mod(expr->unop, state);
                break;
        default:
@@ -610,7 +610,7 @@ static void asm_expr(struct statement *stmt)
                        continue;
                case 2: /* expression */
                        state = 0;
-                       set_extra_expr_mod(expr, extra_undefined(get_type(expr)));
+                       set_extra_expr_mod(expr, alloc_estate_whole(get_type(expr)));
                        continue;
                }
        } END_FOR_EACH_PTR(expr);
@@ -637,7 +637,7 @@ static void match_declarations(struct symbol *sym)
        if (sym->ident) {
                name = sym->ident->name;
                if (!sym->initializer) {
-                       set_state(SMATCH_EXTRA, name, sym, extra_undefined(get_real_base_type(sym)));
+                       set_state(SMATCH_EXTRA, name, sym, alloc_estate_whole(get_real_base_type(sym)));
                        scoped_state_extra(name, sym);
                }
        }
@@ -674,7 +674,7 @@ static void match_function_def(struct symbol *sym)
        FOR_EACH_PTR(sym->ctype.base_type->arguments, arg) {
                if (!arg->ident)
                        continue;
-               set_state(my_id, arg->ident->name, arg, extra_undefined(get_real_base_type(arg)));
+               set_state(my_id, arg->ident->name, arg, alloc_estate_whole(get_real_base_type(arg)));
        } END_FOR_EACH_PTR(arg);
 }
 
index b6c9846..2e4d04e 100644 (file)
@@ -90,7 +90,7 @@ struct smatch_state *alloc_estate_empty(void);
 struct smatch_state *alloc_estate_sval(sval_t sval);
 struct smatch_state *alloc_estate_range(sval_t min, sval_t max);
 struct smatch_state *alloc_estate_rl(struct range_list *rl);
-struct smatch_state *extra_undefined(struct symbol *type);
+struct smatch_state *alloc_estate_whole(struct symbol *type);
 struct smatch_state *clone_estate(struct smatch_state *state);
 
 struct smatch_state *merge_estates(struct smatch_state *s1, struct smatch_state *s2);
index bda4ac1..f26aa74 100644 (file)
@@ -554,7 +554,7 @@ static void match_assign_call(struct expression *expr)
 
        right = strip_expr(expr->right);
        if (right->fn->type != EXPR_SYMBOL || !right->fn->symbol) {
-               set_extra_expr_mod(expr->left, extra_undefined(get_type(expr->left)));
+               set_extra_expr_mod(expr->left, alloc_estate_whole(get_type(expr->left)));
                return;
        }
        fn = right->fn->symbol->ident->name;