macro LFDS710_LIST_ASO_GET_USER_STATE_FROM_STATE

From liblfds.org
Revision as of 08:21, 8 May 2016 by Admin (talk | contribs) (→‎Source File)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source File

└───liblfds710
    └───inc
        └───liblfds710
                lfds710_list_addonly_singlylinked_ordered.h

Opaque Structures

struct lfds710_list_aso_state;

Macro

#define LFDS710_LIST_ASO_GET_USER_STATE_FROM_STATE( list_aso_state )

Parameters

list_aso_state

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

Return Value

Returns a void *, the user_state argument from lfds710_list_aso_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 "liblfds710.h"
#include <stdio.h>
#include <string.h>

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

  struct lfds710_list_aso_state
    laso;

  void
    *user_state;

  lfds710_misc_library_init_valid_on_current_logical_core();

  lfds710_list_aso_init_valid_on_current_logical_core( &laso, strcmp, LFDS710_LIST_ASO_EXISTING_KEY_FAIL, (void *) list_aso_name );

  user_state = LFDS710_LIST_ASO_GET_USER_STATE_FROM_STATE( laso );

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

  lfds710_list_aso_cleanup( &laso, NULL );

  lfds710_misc_library_cleanup();

  return( EXIT_SUCCESS );
}

See Also