Difference between pages "r7.1.1:Macro LFDS711 LIST ASU GET START" and "r7.1.1:Macro LFDS711 LIST ASU GET START AND THEN NEXT"

From liblfds.org
(Difference between pages)
Jump to navigation Jump to search
m (1 revision imported)
 
m (1 revision imported)
 
Line 1: Line 1:
{{DISPLAYTITLE:macro LFDS711_LIST_ASU_GET_START}}
{{DISPLAYTITLE:macro LFDS711_LIST_ASU_GET_START_AND_THEN_NEXT}}
==Source File==
==Source File==
  └───liblfds711
  └───liblfds711
Line 11: Line 11:


==Macro==
==Macro==
  #define LFDS711_LIST_ASU_GET_START( list_state )
  #define LFDS711_LIST_ASU_GET_START_AND_THEN_NEXT( list_asu_state, pointer_to_list_asu_element )


==Parameters==
==Parameters==
''list_state''
''list_asu_state''
: A ''struct lfds711_list_asu_state''.  Not a pointer to it - the struct itself.
: A ''struct lfds711_list_asu_state''.  Not a pointer to it - the struct itself.
''pointer_to_list_asu_element''
: A pointer to ''struct lfds711_list_asu_element''.  This is and only is a pointer - it's not the address of an actual, allocated struct.


==Return Value==
==Return Value==
Returns a ''struct lfds711_list_asu_element *'', a pointer to the first element in the list.
If ''pointer_to_list_element'' is NULL, returns (and sets ''pointer_to_list_element'' to be the same value) a ''struct lfds711_list_asu_element *'' to the first element in the list.
 
If ''pointer_to_list_element'' is not NULL, returns (and sets ''pointer_to_list_element'' to be the same value) a ''struct lfds711_list_asu_element *'' to the element after the list element ''*pointer_to_list_element''.


==Notes==
==Notes==
As with all ''liblfds'' macros, the macro operates on the structure itself, not a pointer to it.
As with all ''liblfds'' macros, the macro operates on the structure itself, not a pointer to it.
This is a convenience macro, expected use is in the conditional part of while loops.  If the 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 should 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==
==Example==

Latest revision as of 18:12, 16 February 2017

Source File

└───liblfds711
    └───inc
        └───liblfds711
                lfds711_list_addonly_singlylinked_unordered.h

Opaque Structures

struct lfds711_list_asu_element;
struct lfds711_list_asu_state;

Macro

#define LFDS711_LIST_ASU_GET_START_AND_THEN_NEXT( list_asu_state, pointer_to_list_asu_element )

Parameters

list_asu_state

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

pointer_to_list_asu_element

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

Return Value

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

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

Notes

As with all liblfds macros, the macro operates on the structure itself, not a pointer to it.

This is a convenience macro, expected use is in the conditional part of while loops. If the 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 should 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

See Also