Changeset eb522e8 in mainline for uspace/lib/c/include/adt/list.h
- Timestamp:
- 2011-06-01T08:43:42Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8d6c1f1
- Parents:
- 9e2e715 (diff), e51a514 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/adt/list.h
r9e2e715 reb522e8 47 47 * 48 48 * @param name Name of the new statically allocated list. 49 * 49 50 */ 50 51 #define LIST_INITIALIZE(name) link_t name = { \ … … 58 59 * 59 60 * @param link Pointer to link_t structure to be initialized. 61 * 60 62 */ 61 63 static inline void link_initialize(link_t *link) … … 70 72 * 71 73 * @param head Pointer to link_t structure representing head of the list. 74 * 72 75 */ 73 76 static inline void list_initialize(link_t *head) … … 83 86 * @param link Pointer to link_t structure to be added. 84 87 * @param head Pointer to link_t structure representing head of the list. 88 * 85 89 */ 86 90 static inline void list_prepend(link_t *link, link_t *head) … … 98 102 * @param link Pointer to link_t structure to be added. 99 103 * @param head Pointer to link_t structure representing head of the list. 104 * 100 105 */ 101 106 static inline void list_append(link_t *link, link_t *head) … … 123 128 * Remove item from doubly-linked circular list. 124 129 * 125 * @param link Pointer to link_t structure to be removed from the list it is contained in. 130 * @param link Pointer to link_t structure to be removed from the list 131 * it is contained in. 132 * 126 133 */ 127 134 static inline void list_remove(link_t *link) … … 137 144 * 138 145 * @param head Pointer to link_t structure representing head of the list. 146 * 139 147 */ 140 148 static inline int list_empty(link_t *head) … … 142 150 return ((head->next == head) ? 1 : 0); 143 151 } 144 145 152 146 153 /** Split or concatenate headless doubly-linked circular list … … 151 158 * concatenates splitted lists and splits concatenated lists. 152 159 * 153 * @param part1 Pointer to link_t structure leading the first (half of the headless) list. 154 * @param part2 Pointer to link_t structure leading the second (half of the headless) list. 160 * @param part1 Pointer to link_t structure leading the first 161 * (half of the headless) list. 162 * @param part2 Pointer to link_t structure leading the second 163 * (half of the headless) list. 164 * 155 165 */ 156 166 static inline void headless_list_split_or_concat(link_t *part1, link_t *part2) … … 165 175 } 166 176 167 168 177 /** Split headless doubly-linked circular list 169 178 * 170 179 * Split headless doubly-linked circular list. 171 180 * 172 * @param part1 Pointer to link_t structure leading the first half of the headless list. 173 * @param part2 Pointer to link_t structure leading the second half of the headless list. 181 * @param part1 Pointer to link_t structure leading 182 * the first half of the headless list. 183 * @param part2 Pointer to link_t structure leading 184 * the second half of the headless list. 185 * 174 186 */ 175 187 static inline void headless_list_split(link_t *part1, link_t *part2) … … 182 194 * Concatenate two headless doubly-linked circular lists. 183 195 * 184 * @param part1 Pointer to link_t structure leading the first headless list. 185 * @param part2 Pointer to link_t structure leading the second headless list. 196 * @param part1 Pointer to link_t structure leading 197 * the first headless list. 198 * @param part2 Pointer to link_t structure leading 199 * the second headless list. 200 * 186 201 */ 187 202 static inline void headless_list_concat(link_t *part1, link_t *part2) … … 190 205 } 191 206 192 #define list_get_instance(link, type, member) ((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member)))) 193 194 extern int list_member(const link_t *link, const link_t *head); 195 extern void list_concat(link_t *head1, link_t *head2); 196 extern unsigned int list_count(const link_t *link); 207 #define list_get_instance(link, type, member) \ 208 ((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member)))) 209 210 #define list_foreach(list, iterator) \ 211 for (link_t *iterator = (list).next; \ 212 iterator != &(list); iterator = iterator->next) 213 214 extern int list_member(const link_t *, const link_t *); 215 extern void list_concat(link_t *, link_t *); 216 extern unsigned int list_count(const link_t *); 197 217 198 218 #endif
Note:
See TracChangeset
for help on using the changeset viewer.