Merge branch 'devel'
[smatch.git] / smatch_ignore.c
blobcf73a0019632fd82e07a40944ef4d9fc8d7a7adb
1 #include "smatch.h"
3 static struct tracker_list *ignored;
5 void add_ignore(const char *name, int owner, struct symbol *sym)
7 struct tracker *tmp;
9 tmp = malloc(sizeof(*tmp));
10 tmp->name = alloc_string(name);
11 tmp->owner = owner;
12 tmp->sym = sym;
13 add_ptr_list(&ignored, tmp);
16 int is_ignored(const char *name, int owner, struct symbol *sym)
18 struct tracker *tmp;
20 FOR_EACH_PTR(ignored, tmp) {
21 if (tmp->owner == owner && tmp->sym == sym
22 && !strcmp(tmp->name, name))
23 return 1;
24 } END_FOR_EACH_PTR(tmp);
25 return 0;
28 static void clear_ignores(void)
30 __free_ptr_list((struct ptr_list **)&ignored);
33 void register_smatch_ignore(int id)
35 add_hook(&clear_ignores, END_FUNC_HOOK);