+// SPDX-License-Identifier: GPL-2.0-or-later
/* Generic linked list
* Copyright (C) 1997, 2000 Kunihiro Ishiguro
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _ZEBRA_LINKLIST_H
*/
extern void list_delete_node(struct list *list, struct listnode *node);
-/*
- * Delete all nodes which satisfy a condition from a list.
- * Deletes the node if cond function returns true for the node.
- * If function ptr passed is NULL, it deletes all nodes
- *
- * list
- * list to operate on
- * cond
- * function pointer which takes node data as input and return true or false
- */
-
-extern void list_filter_out_nodes(struct list *list, bool (*cond)(void *data));
-
/*
* Insert a new element into a list with insertion sort if there is no
* duplicate element present in the list. This assumes the input list is
(node) != NULL && ((data) = static_cast(data, listgetdata(node)), 1); \
(node) = listnextnode(node), ((data) = NULL)
-/* these *do not* cleanup list nodes and referenced data, as the functions
- * do - these macros simply {de,at}tach a listnode from/to a list.
- */
-
-/* List node attach macro. */
-#define LISTNODE_ATTACH(L, N) \
- do { \
- (N)->prev = (L)->tail; \
- (N)->next = NULL; \
- if ((L)->head == NULL) \
- (L)->head = (N); \
- else \
- (L)->tail->next = (N); \
- (L)->tail = (N); \
- (L)->count++; \
- } while (0)
-
-/* List node detach macro. */
-#define LISTNODE_DETACH(L, N) \
- do { \
- if ((N)->prev) \
- (N)->prev->next = (N)->next; \
- else \
- (L)->head = (N)->next; \
- if ((N)->next) \
- (N)->next->prev = (N)->prev; \
- else \
- (L)->tail = (N)->prev; \
- (L)->count--; \
- } while (0)
-
extern struct listnode *listnode_lookup_nocheck(struct list *list, void *data);
/*