]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/liblfds710/src/lfds710_freelist/lfds710_freelist_cleanup.c
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / liblfds710 / src / lfds710_freelist / lfds710_freelist_cleanup.c
1 /***** includes *****/
2 #include "lfds710_freelist_internal.h"
3
4
5
6
7
8 /****************************************************************************/
9 void lfds710_freelist_cleanup( struct lfds710_freelist_state *fs,
10                                void (*element_cleanup_callback)(struct lfds710_freelist_state *fs, struct lfds710_freelist_element *fe) )
11 {
12   struct lfds710_freelist_element
13     *fe,
14     *fe_temp;
15
16   LFDS710_PAL_ASSERT( fs != NULL );
17   // TRD : element_cleanup_callback can be NULL
18
19   LFDS710_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