* src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Remove nodes instantly.

This commit is contained in:
Alexei Podtelezhnikov 2024-04-29 22:34:09 -04:00
parent a209e1adcd
commit 5962d3c1b9
1 changed files with 9 additions and 24 deletions

33
src/cache/ftccache.c vendored
View File

@ -544,7 +544,6 @@
FTC_FaceID face_id )
{
FTC_Manager manager = cache->manager;
FTC_Node frees = NULL;
FT_UFast count = cache->p;
FT_UFast i;
@ -557,41 +556,27 @@
for (;;)
{
FTC_Node node = *pnode;
FT_Bool list_changed = FALSE;
if ( !node )
break;
if ( cache->clazz.node_remove_faceid( node, face_id,
cache, &list_changed ) )
if ( cache->clazz.node_remove_faceid( node, face_id, cache, NULL ) )
{
*pnode = node->link;
node->link = frees;
frees = node;
*pnode = node->link;
manager->cur_weight -= cache->clazz.node_weight( node, cache );
ftc_node_mru_unlink( node, manager );
cache->clazz.node_free( node, cache );
cache->slack++;
}
else
pnode = &node->link;
}
}
/* remove all nodes in the free list */
while ( frees )
{
FTC_Node node;
node = frees;
frees = node->link;
manager->cur_weight -= cache->clazz.node_weight( node, cache );
ftc_node_mru_unlink( node, manager );
cache->clazz.node_free( node, cache );
cache->slack++;
}
ftc_cache_resize( cache );
}