function libtest_pal_free

From liblfds.org
Revision as of 14:57, 28 May 2016 by Admin (talk | contribs) (→‎Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source Files

└───test_and_benchmark
    └───libtest
        ├───inc
        │   └───libtest
        │           libtest_porting_abstraction_layer.h
        └───src
            └───libtest_porting_abstraction_layer
                    libtest_porting_abstraction_layer_free.c

Prototype

void libtest_pal_free( void *memory );

Parameters

void *memory

A pointer returned by libtest_pal_malloc.

Return Value

No return value.

Example

void libtest_pal_free( void *memory )
{
  LFDS710_PAL_ASSERT( memory != NULL );

  free( memory );

  return;
}

Notes

This function is and is only used by one of the unbounded, many producer, many consumer queue tests. This particular queue permits the deallocation of elements after they have left the queue. As such, there is a test which mallocs, queues, then frees. If this function is implemented, the define LIBTEST_PAL_FREE must be created (it only needs to exist; its value is not used). If this define does not exist, then a placeholder function ends up being compiled, so that libtest can compile and in this case, the test which uses this function will not be run.

See Also