Rev 1 | Rev 67 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 62 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #include <list.h> |
29 | #include <list.h> |
30 | 30 | ||
- | 31 | ||
- | 32 | /** Check for membership |
|
- | 33 | * |
|
- | 34 | * Check whether link is contained in the list head. |
|
- | 35 | * The membership is defined as pointer equivalence. |
|
- | 36 | * |
|
- | 37 | * @param link Item to look for. |
|
- | 38 | * @param head List to look in. |
|
- | 39 | * |
|
- | 40 | * @return 1 if link is contained in head, 0 otherwise. |
|
- | 41 | * |
|
- | 42 | */ |
|
31 | int list_member(link_t *link, link_t *head) |
43 | int list_member(link_t *link, link_t *head) |
32 | { |
44 | { |
33 | int found = 0; |
45 | int found = 0; |
34 | link_t *hlp = head->next; |
46 | link_t *hlp = head->next; |
35 | 47 | ||
Line 42... | Line 54... | ||
42 | } |
54 | } |
43 | 55 | ||
44 | return found; |
56 | return found; |
45 | } |
57 | } |
46 | 58 | ||
- | 59 | ||
- | 60 | /** Concatenate two lists |
|
- | 61 | * |
|
- | 62 | * Concatenate lists head1 and head2, producing a single |
|
- | 63 | * list head1 containing items from both (in head1, head2 |
|
- | 64 | * order) and empty list head2. |
|
- | 65 | * |
|
- | 66 | * @param head1 First list and concatenated output |
|
- | 67 | * @param head2 Second list and empty output. |
|
- | 68 | * |
|
- | 69 | */ |
|
47 | void list_concat(link_t *head1, link_t *head2) |
70 | void list_concat(link_t *head1, link_t *head2) |
48 | { |
71 | { |
49 | if (list_empty(head2)) |
72 | if (list_empty(head2)) |
50 | return; |
73 | return; |
51 | 74 |