3 * \brief Map implementation
6 * (c) 2008-2009 Technische Universität Dresden
7 * This file is part of TUD:OS and distributed under the terms of the
8 * GNU Lesser General Public License 2.1.
9 * Please see the COPYING-LGPL-2.1 file for details.
16 #include <l4/sys/compiler.h>
23 * its basically a single linked list with a
24 * key and a data entry
26 typedef struct slmap_t
28 struct slmap_t* next; /* pointer to next entry */
29 void *key; /* the key of the map entry */
30 unsigned key_size; /* the size of the key entry */
31 void *data; /* the data of the map entry */
39 map_new_entry(void* key, unsigned key_size, void *data);
42 map_new_sentry(char* key, void* data);
45 map_append(slmap_t* list, slmap_t* new_entry);
48 map_remove(slmap_t* list, slmap_t* entry);
51 map_free_entry(slmap_t** entry);
53 L4_CV static inline void
54 map_free(slmap_t** list);
56 L4_CV static inline unsigned char
57 map_is_empty(slmap_t* list);
60 map_get_at(slmap_t* list, int n);
63 map_add(slmap_t* list, slmap_t* new_entry);
66 map_insert_after(slmap_t* after, slmap_t* new_entry);
68 L4_CV static inline int
69 map_elements(slmap_t* list);
72 map_find(slmap_t* list, void* key, unsigned key_size);
75 map_sfind(slmap_t* list, const char* key);
78 * implementatic of static inline
81 static inline unsigned char
82 map_is_empty(slmap_t* list)
84 return (list) ? 0 : 1;
88 map_free(slmap_t **list)
91 *list = map_remove(*list, *list);
95 map_elements(slmap_t* list)
98 for (n=0; list; list=list->next)