Changeset 36795edf in mainline for uspace/lib/c/include/adt/list.h
- Timestamp:
- 2021-03-12T19:16:51Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a85d5c6
- Parents:
- 17fac946
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/adt/list.h
r17fac946 r36795edf 38 38 39 39 #include <assert.h> 40 #include <member.h> 40 41 #include <stdbool.h> 41 42 #include <stddef.h> … … 85 86 86 87 #define list_get_instance(link, type, member) \ 87 ((type *) (((void *)(link)) - list_link_to_void(&(((type *) NULL)->member))))88 member_to_inst(link, type, member) 88 89 89 90 #define list_foreach(list, member, itype, iterator) \ 90 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \91 for (itype *iterator = NULL; iterator == NULL; iterator = &((itype *) NULL)[1]) \ 91 92 for (link_t *_link = (list).head.next; \ 92 93 iterator = list_get_instance(_link, itype, member), \ … … 94 95 95 96 #define list_foreach_rev(list, member, itype, iterator) \ 96 for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) 1) \97 for (itype *iterator = NULL; iterator == NULL; iterator = &((itype *) NULL)[1]) \ 97 98 for (link_t *_link = (list).head.prev; \ 98 99 iterator = list_get_instance(_link, itype, member), \ … … 154 155 extern bool list_member(const link_t *, const list_t *); 155 156 extern void list_splice(list_t *, link_t *); 156 extern unsigned longlist_count(const list_t *);157 extern size_t list_count(const list_t *); 157 158 158 159 /** Returns true if the link is definitely part of a list. False if not sure. */ … … 394 395 * 395 396 */ 396 static inline link_t *list_nth(const list_t *list, unsigned longn)397 { 398 unsigned longcnt = 0;397 static inline link_t *list_nth(const list_t *list, size_t n) 398 { 399 size_t cnt = 0; 399 400 400 401 link_t *link = list_first(list);
Note:
See TracChangeset
for help on using the changeset viewer.