From: Dan Carpenter Date: Mon, 28 Jan 2013 06:38:50 +0000 (+0300) Subject: modification_hooks: split out call_modification_hooks_name_sym() X-Git-Tag: 1.57~33 X-Git-Url: https://repo.or.cz/w/smatch.git/commitdiff_plain/ba32ba2227a58edfbf49f59e1c60db8a905f11a2 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 --- 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); }