err_ptr_deref: make err_ptr_min/max static
[smatch.git] / smatch_ignore.c
blobb12d950eb4e6e78d4d2b7565cacd16c75d700e7e
1 /*
2 * Copyright (C) 2009 Dan Carpenter.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
18 #include "smatch.h"
20 static struct tracker_list *ignored;
22 void add_ignore(int owner, const char *name, struct symbol *sym)
24 struct tracker *tmp;
26 tmp = malloc(sizeof(*tmp));
27 tmp->name = alloc_string(name);
28 tmp->owner = owner;
29 tmp->sym = sym;
30 add_ptr_list(&ignored, tmp);
33 int is_ignored(int owner, const char *name, struct symbol *sym)
35 struct tracker *tmp;
37 FOR_EACH_PTR(ignored, tmp) {
38 if (tmp->owner == owner && tmp->sym == sym
39 && !strcmp(tmp->name, name))
40 return 1;
41 } END_FOR_EACH_PTR(tmp);
42 return 0;
45 static void clear_ignores(void)
47 if (__inline_fn)
48 return;
49 __free_ptr_list((struct ptr_list **)&ignored);
52 void register_smatch_ignore(int id)
54 add_hook(&clear_ignores, AFTER_FUNC_HOOK);