2 * audisp-int.c - Minimal linked list library for integers
3 * Copyright (c) 2008 Red Hat Inc., Durham, North Carolina.
6 * This software may be freely redistributed and/or modified under the
7 * terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2, or (at your option) any
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Steve Grubb <sgrubb@redhat.com>
27 #include "audisp-int.h"
29 void ilist_create(ilist *l)
36 int_node *ilist_next(ilist *l)
40 l->cur = l->cur->next;
44 void ilist_append(ilist *l, int num)
48 newnode = malloc(sizeof(int_node));
53 // if we are at top, fix this up
56 else // Otherwise add pointer to newnode
57 l->cur->next = newnode;
59 // make newnode current
64 int ilist_find_num(ilist *l, unsigned int num)
66 register int_node* window = l->head;
69 if (window->num == num) {
74 window = window->next;
79 void ilist_clear(ilist* l)
82 register int_node* current;
89 nextnode=current->next;
98 int ilist_add_if_uniq(ilist *l, int num)
100 register int_node* cur;
110 /* No matches, append to the end */
111 ilist_append(l, num);