/**************************************************************************** * * ftutil.c * * FreeType utility file for memory and list management (body). * * Copyright (C) 2002-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/internal/ftdebug.h> #include <freetype/internal/ftmemory.h> #include <freetype/internal/ftobjs.h> #include <freetype/ftlist.h> /************************************************************************** * * The macro FT_COMPONENT is used in trace mode. It is an implicit * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log * messages during execution. */ #undef FT_COMPONENT #define FT_COMPONENT … /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** *****/ /***** M E M O R Y M A N A G E M E N T *****/ /***** *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ FT_BASE_DEF( FT_Pointer ) ft_mem_alloc( FT_Memory memory, FT_Long size, FT_Error *p_error ) { … } FT_BASE_DEF( FT_Pointer ) ft_mem_qalloc( FT_Memory memory, FT_Long size, FT_Error *p_error ) { … } FT_BASE_DEF( FT_Pointer ) ft_mem_realloc( FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void* block, FT_Error *p_error ) { … } FT_BASE_DEF( FT_Pointer ) ft_mem_qrealloc( FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void* block, FT_Error *p_error ) { … } FT_BASE_DEF( void ) ft_mem_free( FT_Memory memory, const void *P ) { … } FT_BASE_DEF( FT_Pointer ) ft_mem_dup( FT_Memory memory, const void* address, FT_ULong size, FT_Error *p_error ) { … } FT_BASE_DEF( FT_Pointer ) ft_mem_strdup( FT_Memory memory, const char* str, FT_Error *p_error ) { … } FT_BASE_DEF( FT_Int ) ft_mem_strcpyn( char* dst, const char* src, FT_ULong size ) { … } /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** *****/ /***** D O U B L Y L I N K E D L I S T S *****/ /***** *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ #undef FT_COMPONENT #define FT_COMPONENT … /* documentation is in ftlist.h */ FT_EXPORT_DEF( FT_ListNode ) FT_List_Find( FT_List list, void* data ) { … } /* documentation is in ftlist.h */ FT_EXPORT_DEF( void ) FT_List_Add( FT_List list, FT_ListNode node ) { … } /* documentation is in ftlist.h */ FT_EXPORT_DEF( void ) FT_List_Insert( FT_List list, FT_ListNode node ) { … } /* documentation is in ftlist.h */ FT_EXPORT_DEF( void ) FT_List_Remove( FT_List list, FT_ListNode node ) { … } /* documentation is in ftlist.h */ FT_EXPORT_DEF( void ) FT_List_Up( FT_List list, FT_ListNode node ) { … } /* documentation is in ftlist.h */ FT_EXPORT_DEF( FT_Error ) FT_List_Iterate( FT_List list, FT_List_Iterator iterator, void* user ) { … } /* documentation is in ftlist.h */ FT_EXPORT_DEF( void ) FT_List_Finalize( FT_List list, FT_List_Destructor destroy, FT_Memory memory, void* user ) { … } /* END */