macro LFDS710_FREELIST_GET_USER_STATE_FROM_STATE

From liblfds.org
Jump to navigation Jump to search

Source Files

└───liblfds710
    └───inc
        └───liblfds710
                lfds710_freelist.h

Opaque Structures

struct lfds710_freelist_state;

Macro

#define LFDS710_FREELIST_GET_USER_STATE_FROM_STATE( freelist_state )

Parameters

freelist_state

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

Return Value

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

int main()
{
  char
    freelist_name[64] = "Herodotus";

  struct lfds710_freelist_state
    fs;

  void
    *user_state;

  lfds710_misc_library_init_valid_on_current_logical_core();

  lfds710_freelist_init_valid_on_current_logical_core( &fs, (void *) freelist_name );

  user_state = LFDS710_FREELIST_GET_USER_STATE_FROM_STATE( fs );

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

  lfds710_freelist_cleanup( &fs, NULL );

  lfds710_misc_library_cleanup();

  return( EXIT_SUCCESS );
}

See Also