2013-11-27 16:28:31 +01:00
|
|
|
/*
|
2013-06-18 17:21:38 +02:00
|
|
|
* Copyright (C) 2013 Freie Universität Berlin
|
2010-09-22 15:10:42 +02:00
|
|
|
*
|
2013-11-22 20:47:05 +01:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
2013-06-18 17:21:38 +02:00
|
|
|
* Public License. See the file LICENSE in the top level directory for more
|
|
|
|
* details.
|
2013-11-27 16:28:31 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup core_util
|
2010-09-22 15:10:42 +02:00
|
|
|
* @{
|
2013-11-27 16:28:31 +01:00
|
|
|
*
|
|
|
|
* @file clist.h
|
|
|
|
* @brief Circular linkes list
|
|
|
|
*
|
|
|
|
* @author Freie Universität Berlin, Computer Systems & Telematics
|
2014-01-28 11:50:12 +01:00
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
2010-09-22 15:10:42 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CLIST_H
|
|
|
|
#define __CLIST_H
|
|
|
|
|
|
|
|
typedef struct clist_node_t {
|
|
|
|
struct clist_node_t *next;
|
|
|
|
struct clist_node_t *prev;
|
|
|
|
unsigned int data;
|
|
|
|
} clist_node_t;
|
|
|
|
|
|
|
|
/* inserts new_node after node */
|
2013-06-20 18:18:29 +02:00
|
|
|
void clist_add(clist_node_t **node, clist_node_t *new_node);
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
/* removes node. */
|
2013-06-20 18:18:29 +02:00
|
|
|
void clist_remove(clist_node_t **list, clist_node_t *node);
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
/* advances the circle list. second list entry will be first, first is last. */
|
|
|
|
/*void clist_advance(clist_node_t** list);*/
|
|
|
|
|
2013-06-20 18:18:29 +02:00
|
|
|
static inline void clist_advance(clist_node_t **list)
|
|
|
|
{
|
2010-09-22 15:10:42 +02:00
|
|
|
*list = (*list)->next;
|
|
|
|
}
|
|
|
|
|
2013-10-10 17:06:41 +02:00
|
|
|
#if ENABLE_DEBUG
|
2013-06-20 18:18:29 +02:00
|
|
|
void clist_print(clist_node_t *clist);
|
2013-10-10 17:06:41 +02:00
|
|
|
#endif
|
2010-09-22 15:10:42 +02:00
|
|
|
|
2013-11-27 16:28:31 +01:00
|
|
|
/** @} */
|
2010-09-22 15:10:42 +02:00
|
|
|
#endif // __CLIST_H
|