From ba32ba2227a58edfbf49f59e1c60db8a905f11a2 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 28 Jan 2013 09:38:50 +0300 Subject: [PATCH] modification_hooks: split out call_modification_hooks_name_sym() 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 --- smatch_modification_hooks.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/smatch_modification_hooks.c b/smatch_modification_hooks.c index 09fe7ece..5818a389 100644 --- a/smatch_modification_hooks.c +++ b/smatch_modification_hooks.c @@ -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); } -- 2.11.4.GIT