* src/bdf/bdflib.c (bdf_load_font): Remove memory shuffling.

This commit is contained in:
Alexei Podtelezhnikov 2021-09-02 22:52:21 -04:00
parent a81cf5aade
commit 0a6f0f8fed
1 changed files with 3 additions and 11 deletions

View File

@ -2164,27 +2164,25 @@
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
bdf_load_font( FT_Stream stream, bdf_load_font( FT_Stream stream,
FT_Memory extmemory, FT_Memory memory,
bdf_options_t* opts, bdf_options_t* opts,
bdf_font_t* *font ) bdf_font_t* *font )
{ {
unsigned long lineno = 0; /* make compiler happy */ unsigned long lineno = 0; /* make compiler happy */
_bdf_parse_t *p = NULL; _bdf_parse_t *p = NULL;
FT_Memory memory = extmemory; /* needed for FT_NEW */
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
if ( FT_NEW( p ) ) if ( FT_NEW( p ) )
goto Exit; goto Exit;
memory = NULL;
p->opts = (bdf_options_t*)( ( opts != 0 ) ? opts : &_bdf_opts ); p->opts = (bdf_options_t*)( ( opts != 0 ) ? opts : &_bdf_opts );
p->minlb = 32767; p->minlb = 32767;
p->size = stream->size; p->size = stream->size;
p->memory = extmemory; /* only during font creation */ p->memory = memory; /* only during font creation */
_bdf_list_init( &p->list, extmemory ); _bdf_list_init( &p->list, memory );
error = _bdf_readstream( stream, _bdf_parse_start, error = _bdf_readstream( stream, _bdf_parse_start,
(void *)p, &lineno ); (void *)p, &lineno );
@ -2275,8 +2273,6 @@
if ( p->font != 0 ) if ( p->font != 0 )
{ {
/* Make sure the comments are NULL terminated if they exist. */ /* Make sure the comments are NULL terminated if they exist. */
memory = p->font->memory;
if ( p->font->comments_len > 0 ) if ( p->font->comments_len > 0 )
{ {
if ( FT_QRENEW_ARRAY( p->font->comments, if ( FT_QRENEW_ARRAY( p->font->comments,
@ -2297,8 +2293,6 @@
{ {
_bdf_list_done( &p->list ); _bdf_list_done( &p->list );
memory = extmemory;
FT_FREE( p->glyph_name ); FT_FREE( p->glyph_name );
FT_FREE( p ); FT_FREE( p );
} }
@ -2308,8 +2302,6 @@
Fail: Fail:
bdf_free_font( p->font ); bdf_free_font( p->font );
memory = extmemory;
FT_FREE( p->font ); FT_FREE( p->font );
goto Exit; goto Exit;