Go to the source code of this file.
Legato Singly Linked List API include file.
Copyright (C) Sierra Wireless Inc.
When a link is created, it must be initialized by assigning this macro to the link before it can be used.
When a list is created, it must be initialized by assigning this macro to the list before the list can be used.
Adds a link after currentLinkPtr. Ensure that currentLinkPtr is in the list otherwise the behaviour of this function is undefined.
- Parameters
-
[in] | listPtr | List to add to. |
[in] | currentLinkPtr | New link will be inserted after this link. |
[in] | newLinkPtr | New link to add. |
Checks if a list is empty.
- Returns
- true if empty, false if not empty.
- Parameters
-
Checks if a link is at the head of the list (next to be popped).
- Returns
- true if the link is at the head of the list.
- false if not.
- Parameters
-
[in] | listPtr | List to check. |
[in] | linkPtr | Check if this link is at the head of the list. |
Checks if a link is in the list.
- Returns
- true if the link is in the list.
- false if the link is not in the list.
- Parameters
-
[in] | listPtr | List to check. |
[in] | linkPtr | Check if this link is in the list. |
Checks if the list is corrupted.
- Returns
- true if the list is corrupted. false if the list is not corrupted.
- Parameters
-
[in] | listPtr | List to check. |
Checks if a link is at the tail of the list (last to be popped).
- Returns
- true if the link is at the tail of the list.
- false if not.
- Parameters
-
[in] | listPtr | List to check. |
[in] | linkPtr | Check if this link is at the tail of the list. |
Returns the number of links in a list.
- Returns
- Number of links.
- Parameters
-
[in] | listPtr | List to count. |
Returns the link at the head of the list without removing it from the list.
- Returns
- Pointer to the head link if successful. NULL if the list is empty.
- Parameters
-
Returns the link next to currentLinkPtr (i.e., the link beside currentLinkPtr that's closer to the tail) without removing it from the list. Ensure currentLinkPtr is in the list otherwise the behaviour of this function is undefined.
- Returns
- Pointer to the next link if successful. NULL if there is no link next to the currentLinkPtr (currentLinkPtr is at the tail of the list).
- Parameters
-
[in] | listPtr | List containing currentLinkPtr. |
[in] | currentLinkPtr | Get the link that is relative to this link. |
Returns the link at the tail of the list without removing it from the list.
- Returns
- A pointer to the tail link if successful. NULL if the list is empty.
- Parameters
-
Removes and returns the link at the head of the list.
- Returns
- Removed link. NULL if the link is not available because the list is empty.
- Parameters
-
[in] | listPtr | List to remove from. |
Adds a link to the tail of the list.
- Parameters
-
[in] | listPtr | List to add to. |
[in] | newLinkPtr | New link to add. |
Removes the link found after currentLinkPtr. The user must ensure that currentLinkPtr is in the list otherwise the behaviour of this function is undefined.
- Returns
- Pointer to the removed link. NULL if there are no more links in the list after currentLinkPtr.
- Parameters
-
[in] | listPtr | The list to remove from. |
[in] | currentLinkPtr | The link after this one will be removed from the list. |
Adds a link at the head of the list.
- Parameters
-
[in] | listPtr | List to add to. |
[in] | newLinkPtr | New link to add. |