* include/freetype/ftstream.h, src/base/ftstream.c: modifying

various frame-related functions to report the place where the
    frames were entered/extracted/exited/released in the memory debugger.
This commit is contained in:
David Turner 2006-05-02 10:21:28 +00:00
parent 9ca782569c
commit 9482ba50b7
3 changed files with 28 additions and 10 deletions

View File

@ -1,5 +1,9 @@
2006-05-02 David Turner <david@freetype.org>
* include/freetype/ftstream.h, src/base/ftstream.c: modifying
various frame-related functions to report the place where the
frames were entered/extracted/exited/released in the memory debugger.
* include/freetype/internal/ftmemory.h, src/base/ftbitmap.c,
src/base/ftmac.c, src/base/ftrfork.c, src/lzw/ftzopen.c,
src/raster/ftrend1.c, src/sfnt/ttpost.c, src/truetype/ttgxvar.c,

View File

@ -515,17 +515,18 @@ FT_BEGIN_HEADER
#define FT_FRAME_ENTER( size ) \
FT_SET_ERROR( FT_Stream_EnterFrame( stream, size ) )
FT_SET_ERROR( FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) )
#define FT_FRAME_EXIT() \
FT_Stream_ExitFrame( stream )
FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )
#define FT_FRAME_EXTRACT( size, bytes ) \
FT_SET_ERROR( FT_Stream_ExtractFrame( stream, size, \
(FT_Byte**)&(bytes) ) )
#define FT_FRAME_EXTRACT( size, bytes ) \
FT_SET_ERROR( \
FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size, \
(FT_Byte**)&(bytes) ) ) )
#define FT_FRAME_RELEASE( bytes ) \
FT_Stream_ReleaseFrame( stream, (FT_Byte**)&(bytes) )
FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, (FT_Byte**)&(bytes) ) )
FT_END_HEADER

View File

@ -212,8 +212,12 @@
{
FT_Memory memory = stream->memory;
#ifdef FT_DEBUG_MEMORY
ft_mem_free( memory, *pbytes );
*pbytes = NULL;
#else
FT_FREE( *pbytes );
#endif
}
*pbytes = 0;
}
@ -235,10 +239,15 @@
/* allocate the frame in memory */
FT_Memory memory = stream->memory;
#ifdef FT_DEBUG_MEMORY
/* assume _ft_debug_file and _ft_debug_lineno are already set */
stream->base = ft_mem_qalloc( memory, count, &error );
if ( error )
goto Exit;
#else
if ( FT_QALLOC( stream->base, count ) )
goto Exit;
#endif
/* read it */
read_bytes = stream->read( stream, stream->pos,
stream->base, count );
@ -298,8 +307,12 @@
{
FT_Memory memory = stream->memory;
#ifdef FT_DEBUG_MEMORY
ft_mem_free( memory, stream->base );
stream->base = NULL;
#else
FT_FREE( stream->base );
#endif
}
stream->cursor = 0;
stream->limit = 0;