diff options
Diffstat (limited to 'src/cache/ftlru.c')
-rw-r--r-- | src/cache/ftlru.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c index eed41f5ce..5c4183b7c 100644 --- a/src/cache/ftlru.c +++ b/src/cache/ftlru.c @@ -35,6 +35,7 @@ FT_Error error; FT_LruList list; + if ( !alist || !clazz ) return FTC_Err_Invalid_Argument; @@ -72,6 +73,7 @@ FT_Memory memory; FT_LruList_Class clazz; + if ( !list ) return; @@ -87,7 +89,6 @@ } - FT_EXPORT_DEF( void ) FT_LruList_Reset( FT_LruList list ) { @@ -107,6 +108,7 @@ { FT_LruNode next = node->next; + if ( clazz->node_done ) clazz->node_done( node, list ); @@ -179,7 +181,7 @@ { *pnode = node->next; node->next = list->nodes; - list->nodes = node; + list->nodes = node; } result = node; goto Exit; @@ -193,9 +195,10 @@ if ( list->max_nodes > 0 && list->num_nodes >= list->max_nodes ) { /* this list list is full; we will now flush */ - /* the oldest node, if there's one !! */ + /* the oldest node, if there's one! */ FT_LruNode last = *plast; + if ( last ) { if ( clazz->node_flush ) @@ -223,7 +226,7 @@ } /* in case of error during the flush or done/init cycle, */ - /* we need to discard the node.. */ + /* we need to discard the node */ if ( clazz->node_done ) clazz->node_done( last, list ); @@ -258,13 +261,13 @@ } - FT_EXPORT_DEF( void ) FT_LruList_Remove( FT_LruList list, FT_LruNode node ) { FT_LruNode *pnode; + if ( !list || !node ) return; @@ -276,6 +279,7 @@ FT_Memory memory = list->memory; FT_LruList_Class clazz = list->clazz; + *pnode = node->next; node->next = NULL; @@ -292,7 +296,6 @@ } - FT_EXPORT_DEF( void ) FT_LruList_Remove_Selection( FT_LruList list, FT_LruNode_SelectFunc select_func, @@ -302,6 +305,7 @@ FT_LruList_Class clazz; FT_Memory memory; + if ( !list || !select_func ) return; |