]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.0.0 / liblfds700 / src / lfds700_freelist / lfds700_freelist_cleanup.c
1 /***** includes *****/
2 #include "lfds700_freelist_internal.h"
3
4
5
6
7
8 /****************************************************************************/
9 void lfds700_freelist_cleanup( struct lfds700_freelist_state *fs,
10                                void (*element_cleanup_callback)(struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe) )
11 {
12   struct lfds700_freelist_element
13     *fe,
14     *fe_temp;
15
16   LFDS700_PAL_ASSERT( fs != NULL );
17   // TRD : element_cleanup_callback can be NULL
18
19   LFDS700_MISC_BARRIER_LOAD;
20
21   if( element_cleanup_callback != NULL )
22   {
23     fe = fs->top[POINTER];
24
25     while( fe != NULL )
26     {
27       fe_temp = fe;
28       fe = fe->next;
29
30       element_cleanup_callback( fs, fe_temp );
31     }
32   }
33
34   return;
35 }
36