From fea5ac3279d1689dff2be60c08699869863614eb Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 20 Feb 2013 15:01:22 +0300 Subject: [PATCH] db: move an option_no_db check to run_sql() We want to be able to use these hooks for the in-memory database as well as the on-disk database. So I've moved the check to run_sql(). Signed-off-by: Dan Carpenter --- smatch.h | 2 ++ smatch_db.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/smatch.h b/smatch.h index 4899f916..44383f9c 100644 --- a/smatch.h +++ b/smatch.h @@ -499,6 +499,8 @@ char *get_variable_from_key(struct expression *arg, char *key, struct symbol **s #define run_sql(call_back, sql...) \ do { \ char sql_txt[1024]; \ + if (option_no_db) \ + break; \ snprintf(sql_txt, 1024, sql); \ sm_debug("%s\n", sql_txt); \ sql_exec(call_back, sql_txt); \ diff --git a/smatch_db.c b/smatch_db.c index d450da23..48b645cc 100644 --- a/smatch_db.c +++ b/smatch_db.c @@ -864,9 +864,6 @@ void register_definition_db_callbacks(int id) add_hook(&call_return_state_hooks, RETURN_HOOK); add_hook(&match_end_func_info, END_FUNC_HOOK); - if (option_no_db) - return; - add_hook(&match_data_from_db, FUNC_DEF_HOOK); add_hook(&match_call_implies, FUNCTION_CALL_HOOK); } -- 2.11.4.GIT