3 * \brief Map implementation
6 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
7 * Ronald Aigner <ra3@os.inf.tu-dresden.de>
8 * economic rights: Technische Universität Dresden (Germany)
9 * This file is part of TUD:OS and distributed under the terms of the
10 * GNU Lesser General Public License 2.1.
11 * Please see the COPYING-LGPL-2.1 file for details.
18 #include <l4/sys/compiler.h>
25 * its basically a single linked list with a
26 * key and a data entry
28 typedef struct slmap_t
30 struct slmap_t* next; /* pointer to next entry */
31 void *key; /* the key of the map entry */
32 unsigned key_size; /* the size of the key entry */
33 void *data; /* the data of the map entry */
41 map_new_entry(void* key, unsigned key_size, void *data);
44 map_new_sentry(char* key, void* data);
47 map_append(slmap_t* list, slmap_t* new_entry);
50 map_remove(slmap_t* list, slmap_t* entry);
53 map_free_entry(slmap_t** entry);
55 L4_CV static inline void
56 map_free(slmap_t** list);
58 L4_CV static inline unsigned char
59 map_is_empty(slmap_t* list);
62 map_get_at(slmap_t* list, int n);
65 map_add(slmap_t* list, slmap_t* new_entry);
68 map_insert_after(slmap_t* after, slmap_t* new_entry);
70 L4_CV static inline int
71 map_elements(slmap_t* list);
74 map_find(slmap_t* list, void* key, unsigned key_size);
77 map_sfind(slmap_t* list, const char* key);
80 * implementatic of static inline
83 static inline unsigned char
84 map_is_empty(slmap_t* list)
86 return (list) ? 0 : 1;
90 map_free(slmap_t **list)
93 *list = map_remove(*list, *list);
97 map_elements(slmap_t* list)
100 for (n=0; list; list=list->next)