modification_hooks: split out call_modification_hooks_name_sym()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 28 Jan 2013 06:38:50 +0000 (28 09:38 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Mon, 28 Jan 2013 06:38:50 +0000 (28 09:38 +0300)
I want a separate function that I will use later called
call_modification_hooks_name_sym() which takes a name and a symbol instead
of an expression.

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

index 09fe7ec..5818a38 100644 (file)
@@ -57,17 +57,12 @@ static int matches(char *name, struct symbol *sym, struct sm_state *sm)
        return match_none;
 }
 
-static void call_modification_hooks(struct expression *expr)
+static void call_modification_hooks_name_sym(char *name, struct symbol *sym)
 {
-       char *name;
-       struct symbol *sym;
        struct state_list *slist;
        struct sm_state *sm;
        int match;
 
-       name = expr_to_var_sym(expr, &sym);
-       if (!name || !sym)
-               goto free;
        slist = __get_cur_slist();
 
        FOR_EACH_PTR(slist, sm) {
@@ -81,6 +76,17 @@ static void call_modification_hooks(struct expression *expr)
                if (match == match_indirect && indirect_hooks[sm->owner])
                        (indirect_hooks[sm->owner])(sm);
        } END_FOR_EACH_PTR(sm);
+}
+
+static void call_modification_hooks(struct expression *expr)
+{
+       char *name;
+       struct symbol *sym;
+
+       name = expr_to_var_sym(expr, &sym);
+       if (!name || !sym)
+               goto free;
+       call_modification_hooks_name_sym(name, sym);
 free:
        free_string(name);
 }