macro LFDS700_LIST_AOS_GET_USER_STATE_FROM_STATE

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_state;

Macro

#define LFDS700_LIST_AOS_GET_USER_STATE_FROM_STATE( list_aos_state )

Parameters

list_aos_state

An initialized struct lfds700_list_aos_state. Not a pointer to it - the struct itself.

Return Value

Returns a void *, the user_state argument from lfds700_list_aos_init_valid_on_current_logical_core.

Notes

The user state value can only be set the once, when the data structure instance is initialized.

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

Example

#include "liblfds700.h"
#include <stdio.h>
#include <string.h>

int main()
{
  char
    list_aos_name[64] = "Bring It On";

  struct lfds700_list_aos_state
    laos;

  void
    *user_state;

  lfds700_misc_library_init_valid_on_current_logical_core();

  lfds700_list_aos_init_valid_on_current_logical_core( &laos, strcmp, LFDS700_LIST_AOS_EXISTING_KEY_FAIL, (void *) list_aos_name );

  user_state = LFDS700_LIST_AOS_GET_USER_STATE_FROM_STATE( laos );

  printf( "list_aos name is \"%s\"\n", (char *) user_state );

  lfds700_list_aos_cleanup( &laos, NULL );

  lfds700_misc_library_cleanup();

  return( EXIT_SUCCESS );
}

See Also