2 * audispd-llist.c - Minimal linked list library
3 * Copyright (c) 2007,2013 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 "audispd-llist.h"
29 void plist_create(conf_llist *l)
36 void plist_last(conf_llist *l)
38 register lnode* window;
45 window = window->next;
49 lnode *plist_next(conf_llist *l)
53 l->cur = l->cur->next;
57 unsigned int plist_count_active(const conf_llist *l)
59 register lnode* current;
64 if (current->p && current->p->active == A_YES)
66 current=current->next;
71 void plist_append(conf_llist *l, plugin_conf_t *p)
75 newnode = malloc(sizeof(lnode));
78 void *pp = malloc(sizeof(struct plugin_conf));
80 memcpy(pp, p, sizeof(struct plugin_conf));
87 // if we are at top, fix this up
90 else // Otherwise add pointer to newnode
91 l->cur->next = newnode;
93 // make newnode current
98 void plist_clear(conf_llist* l)
101 register lnode* current;
105 nextnode=current->next;
115 void plist_mark_all_unchecked(conf_llist* l)
117 register lnode* current;
122 current->p->checked = 0;
123 current=current->next;
127 lnode *plist_find_unchecked(conf_llist* l)
129 register lnode* current;
133 if (current->p && current->p->checked == 0)
135 current=current->next;
140 lnode *plist_find_name(conf_llist* l, const char *name)
142 register lnode* current;
149 if (current->p && current->p->name) {
150 if (strcmp(current->p->name, name) == 0)
153 current=current->next;