lists.h

Go to the documentation of this file.
00001 /*
00002         libbroadway - A general purpose library to control the Wii.
00003         Double-linked lists implementation
00004 
00005 Copyright (C) 2010      Alex Marshall <trap15@raidenii.net>
00006 
00007 # This code is licensed to you under the terms of the GNU GPL, version 2;
00008 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
00009 */
00010 
00015 #ifndef __LISTS_H__
00016 #define __LISTS_H__
00017 
00023 typedef struct linked_node_t {
00024         struct linked_node_t*   next;   
00025         struct linked_node_t*   prev;   
00026 } linked_node_t;
00027 
00038 #define linked_walk(list, condition) do { \
00039         if((list) == NULL) { walk = NULL; break; } \
00040         for(walk = (list); (walk->next != NULL) && (condition); walk = walk->next); \
00041         if(!(condition)) walk = NULL; /* Our condition never happened, so we have no result */ \
00042 } while(0)
00043 
00051 linked_node_t* linked_make(size_t size);
00058 void* linked_add_first(void* l, void *n);
00065 void* linked_add_last(void* l, void *n);
00073 void* linked_add_before(void* l, void *n, void* node);
00081 void* linked_add_after(void* l, void *n, void* node);
00087 void linked_del(void* l, void* node);
00088 
00089 #endif
00090 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated by  doxygen 1.6.3