diff options
Diffstat (limited to 'src/3rdparty/freetype/src/cache/ftcmru.c')
-rw-r--r-- | src/3rdparty/freetype/src/cache/ftcmru.c | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/src/3rdparty/freetype/src/cache/ftcmru.c b/src/3rdparty/freetype/src/cache/ftcmru.c index 1087be4d89..ad10a06bc4 100644 --- a/src/3rdparty/freetype/src/cache/ftcmru.c +++ b/src/3rdparty/freetype/src/cache/ftcmru.c @@ -1,26 +1,25 @@ -/***************************************************************************/ -/* */ -/* ftcmru.c */ -/* */ -/* FreeType MRU support (body). */ -/* */ -/* Copyright 2003-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include <ft2build.h> -#include FT_CACHE_H +/**************************************************************************** + * + * ftcmru.c + * + * FreeType MRU support (body). + * + * Copyright (C) 2003-2023 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + +#include <freetype/ftcache.h> #include "ftcmru.h" -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H +#include <freetype/internal/ftobjs.h> +#include <freetype/internal/ftdebug.h> #include "ftcerror.h" @@ -263,6 +262,8 @@ if ( list->clazz.node_done ) list->clazz.node_done( node, list->data ); } + + /* zero new node in case of node_init failure */ else if ( FT_ALLOC( node, list->clazz.node_size ) ) goto Exit; @@ -328,29 +329,23 @@ FTC_MruNode_CompareFunc selection, FT_Pointer key ) { - FTC_MruNode first, node, next; + FTC_MruNode first = list->nodes; + FTC_MruNode prev, node; - first = list->nodes; - while ( first && ( !selection || selection( first, key ) ) ) - { - FTC_MruList_Remove( list, first ); - first = list->nodes; - } + if ( !first || !selection ) + return; - if ( first ) + prev = first->prev; + do { - node = first->next; - while ( node != first ) - { - next = node->next; + node = prev; + prev = node->prev; - if ( selection( node, key ) ) - FTC_MruList_Remove( list, node ); + if ( selection( node, key ) ) + FTC_MruList_Remove( list, node ); - node = next; - } - } + } while ( node != first ); } |