free: add kmem_cache_free() as a freeing function
[smatch.git] / smatch_ignore.c
blob5202ee35bae7aa68aa4cec7b89109b4de225ece9
1 /*
2 * sparse/smatch_tracker.c
4 * Copyright (C) 2009 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
10 #include "smatch.h"
12 static struct tracker_list *ignored;
14 void add_ignore(int owner, const char *name, struct symbol *sym)
16 struct tracker *tmp;
18 tmp = malloc(sizeof(*tmp));
19 tmp->name = alloc_string(name);
20 tmp->owner = owner;
21 tmp->sym = sym;
22 add_ptr_list(&ignored, tmp);
25 int is_ignored(int owner, const char *name, struct symbol *sym)
27 struct tracker *tmp;
29 FOR_EACH_PTR(ignored, tmp) {
30 if (tmp->owner == owner && tmp->sym == sym
31 && !strcmp(tmp->name, name))
32 return 1;
33 } END_FOR_EACH_PTR(tmp);
34 return 0;
37 static void clear_ignores(void)
39 if (__inline_fn)
40 return;
41 __free_ptr_list((struct ptr_list **)&ignored);
44 void register_smatch_ignore(int id)
46 add_hook(&clear_ignores, END_FUNC_HOOK);