Rev 2479 | Rev 4509 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2479 | Rev 4415 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | * @return true if link is contained in head, false otherwise. |
46 | * @return true if link is contained in head, false otherwise. |
47 | * |
47 | * |
48 | */ |
48 | */ |
49 | int list_member(const link_t *link, const link_t *head) |
49 | int list_member(const link_t *link, const link_t *head) |
50 | { |
50 | { |
51 | int found = false; |
51 | int found = 0; |
52 | link_t *hlp = head->next; |
52 | link_t *hlp = head->next; |
53 | 53 | ||
54 | while (hlp != head) { |
54 | while (hlp != head) { |
55 | if (hlp == link) { |
55 | if (hlp == link) { |
56 | found = true; |
56 | found = 1; |
57 | break; |
57 | break; |
58 | } |
58 | } |
59 | hlp = hlp->next; |
59 | hlp = hlp->next; |
60 | } |
60 | } |
61 | 61 | ||
Line 83... | Line 83... | ||
83 | head1->prev->next = head2->next; |
83 | head1->prev->next = head2->next; |
84 | head1->prev = head2->prev; |
84 | head1->prev = head2->prev; |
85 | list_initialize(head2); |
85 | list_initialize(head2); |
86 | } |
86 | } |
87 | 87 | ||
- | 88 | ||
- | 89 | /** Count list items |
|
- | 90 | * |
|
- | 91 | * Return the number of items in the list. |
|
- | 92 | * |
|
- | 93 | * @param link List to count. |
|
- | 94 | * |
|
- | 95 | * @return Number of items in the list. |
|
- | 96 | * |
|
- | 97 | */ |
|
- | 98 | unsigned int list_count(const link_t *link) |
|
- | 99 | { |
|
- | 100 | unsigned int count = 0; |
|
- | 101 | link_t *hlp = link->next; |
|
- | 102 | ||
- | 103 | while (hlp != link) { |
|
- | 104 | count++; |
|
- | 105 | hlp = hlp->next; |
|
- | 106 | } |
|
- | 107 | ||
- | 108 | return count; |
|
- | 109 | } |
|
- | 110 | ||
88 | /** @} |
111 | /** @} |
89 | */ |
112 | */ |