From 5f069a06100bfe01cd907a85c173d68606826abf Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 21 Feb 2013 10:26:36 +0300 Subject: [PATCH] db: rename function_id in the caller_info table to call_id This isn't a function_id at all, it's a caller id. Signed-off-by: Dan Carpenter --- smatch_data/db/caller_info.schema | 6 +++--- smatch_data/db/fill_db_caller_info.pl | 8 ++++---- smatch_db.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/smatch_data/db/caller_info.schema b/smatch_data/db/caller_info.schema index d38d015b..3d2682de 100644 --- a/smatch_data/db/caller_info.schema +++ b/smatch_data/db/caller_info.schema @@ -1,5 +1,5 @@ -CREATE TABLE caller_info (file varchar(128), caller varchar(64), function varchar(64), function_id integer, static integer, type integer, parameter integer, key varchar(256), value varchar(256)); +CREATE TABLE caller_info (file varchar(128), caller varchar(64), function varchar(64), call_id integer, static integer, type integer, parameter integer, key varchar(256), value varchar(256)); -CREATE INDEX caller_fn_idx on caller_info (function, function_id); -CREATE INDEX caller_ff_idx on caller_info (file, function, function_id); +CREATE INDEX caller_fn_idx on caller_info (function, call_id); +CREATE INDEX caller_ff_idx on caller_info (file, function, call_id); diff --git a/smatch_data/db/fill_db_caller_info.pl b/smatch_data/db/fill_db_caller_info.pl index a17a23b5..131eab47 100755 --- a/smatch_data/db/fill_db_caller_info.pl +++ b/smatch_data/db/fill_db_caller_info.pl @@ -41,12 +41,12 @@ $db->do("PRAGMA synchronous = OFF"); $db->do("PRAGMA cache_size = 800000"); $db->do("PRAGMA journal_mode = OFF"); -my $func_id = 0; +my $call_id = 0; my ($fn, $dummy, $sql); open(WARNS, "<$warns"); while () { - # test.c:11 frob() SQL_caller_info: insert into caller_info values ('test.c', 'frob', '__smatch_buf_size', %FUNC_ID%, 1, 0, -1, '', '); + # test.c:11 frob() SQL_caller_info: insert into caller_info values ('test.c', 'frob', '__smatch_buf_size', %CALL_ID%, 1, 0, -1, '', '); if (!($_ =~ /^.*? \w+\(\) SQL_caller_info: /)) { next; @@ -66,10 +66,10 @@ while () { ($dummy, $dummy, $sql) = split(/:/); - $sql =~ s/%FUNC_ID%/$func_id/; + $sql =~ s/%CALL_ID%/$call_id/; if ($sql =~ /%call_marker%/) { $sql =~ s/%call_marker%//; # don't need this taking space in the db. - $func_id++; + $call_id++; } $db->do($sql); diff --git a/smatch_db.c b/smatch_db.c index 15f7d350..aff7f3f6 100644 --- a/smatch_db.c +++ b/smatch_db.c @@ -157,7 +157,7 @@ void sql_insert_caller_info(struct expression *call, int type, return; sm_msg("SQL_caller_info: insert into caller_info values (" - "'%s', '%s', '%s', %%FUNC_ID%%, %d, %d, %d, '%s', '%s');", + "'%s', '%s', '%s', %%CALL_ID%%, %d, %d, %d, '%s', '%s');", get_filename(), get_function(), fn, is_static(call->fn), type, param, key, value); @@ -255,13 +255,13 @@ void sql_select_caller_info(const char *cols, struct symbol *sym, int (*callback)(void*, int, char**, char**)) { if (__inline_fn) { - mem_sql(callback, "select %s from caller_info where function_id = %lu;", + mem_sql(callback, "select %s from caller_info where call_id = %lu;", cols, (unsigned long)__inline_fn); return; } run_sql(callback, - "select %s from caller_info where %s order by function_id;", + "select %s from caller_info where %s order by call_id;", cols, get_static_filter(sym)); } @@ -481,7 +481,7 @@ static int db_callback(void *unused, int argc, char **argv, char **azColName) static void get_direct_callers(struct symbol *sym) { - sql_select_caller_info("function_id, type, parameter, key, value", sym, + sql_select_caller_info("call_id, type, parameter, key, value", sym, db_callback); } @@ -517,8 +517,8 @@ static void get_function_pointer_callers(struct symbol *sym) if (!ptr_name) return; - run_sql(db_callback, "select function_id, type, parameter, key, value from caller_info" - " where function = '%s' order by function_id", ptr_name); + run_sql(db_callback, "select call_id, type, parameter, key, value from caller_info" + " where function = '%s' order by call_id", ptr_name); free_string(ptr_name); } -- 2.11.4.GIT