Add a comment showing where the tests are supposed to go.
[smatch.git] / smatch_ignore.c
blob4ae9b49575c82f8a37a3154b3622e23a399c310e
1 #include "smatch.h"
3 struct tracker {
4 const char *name;
5 int owner;
6 struct symbol *sym;
7 };
8 DECLARE_PTR_LIST(tracker_list, struct tracker);
10 static struct tracker_list *ignored;
12 void add_ignore(const char *name, int owner, struct symbol *sym)
14 struct tracker *tmp;
16 tmp = malloc(sizeof(*tmp));
17 tmp->name = name;
18 tmp->owner = owner;
19 tmp->sym = sym;
20 add_ptr_list(&ignored, tmp);
23 int is_ignored(const char *name, int owner, struct symbol *sym)
25 struct tracker *tmp;
27 FOR_EACH_PTR(ignored, tmp) {
28 if (tmp->owner == owner && tmp->sym == sym
29 && !strcmp(tmp->name, name))
30 return 1;
31 } END_FOR_EACH_PTR(tmp);
32 return 0;
35 static void clear_ignores()
37 __free_ptr_list((struct ptr_list **)&ignored);
40 void register_smatch_ignore(int id)
42 add_hook(&clear_ignores, END_FUNC_HOOK);