macro LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT

From liblfds.org
Jump to navigation Jump to search

Source File

└───liblfds700
    └───inc
        └───liblfds700
                lfds700_list_addonly_ordered_singlylinked.h

Opaque Structures

struct lfds700_list_aos_element;
struct lfds700_list_aos_state;

Macro

#define LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT( list_aos_state, pointer_to_list_aos_element )

Parameters

list_aos_state

A struct lfds700_list_aos_state. Not a pointer to it - the struct itself.

pointer_to_list_aos_element

A pointer to struct lfds700_list_aos_element. This is and only is a pointer - it's not the address of an actual, allocated struct.

Return Value

If pointer_to_list_aos_element is NULL, returns (and sets pointer_to_list_aos_element to be the same value) a struct lfds700_list_aos_element * to the first element in the list.

If pointer_to_list_aos_element is not NULL, returns (and sets pointer_to_list_aos_element to be the same value) a struct lfds700_list_aos_element * to the element after the list element *pointer_to_list_aos_element.

Notes

This is a convenience macro, expected use is in the conditional part of while loops. If the pointer_to_list_aos_element argument is NULL, then the macro returns (and sets the element pointer to be) the first element; if it is non-NULL (and then mustt be a pointer to an element in the list), then the macro returns (and sets the element pointer to be) the next element in the list, eventully returning (and setting the element pointer to be) NULL, which causes the while loop to finish.

Example

Coming soon. No, really! (Written 29th Dec 2015).

See Also