[truetype] Clean up `exec` initialization.
* src/truetype/ttinterp.c (Init_Context): Absorbed into... (TT_New_Context): ... this function.
This commit is contained in:
parent
fab94f9fcc
commit
073ff2d77e
|
@ -275,64 +275,6 @@
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @Function:
|
||||
* Init_Context
|
||||
*
|
||||
* @Description:
|
||||
* Initializes a context object.
|
||||
*
|
||||
* @Input:
|
||||
* memory ::
|
||||
* A handle to the parent memory object.
|
||||
*
|
||||
* @InOut:
|
||||
* exec ::
|
||||
* A handle to the target execution context.
|
||||
*
|
||||
* @Return:
|
||||
* FreeType error code. 0 means success.
|
||||
*/
|
||||
static FT_Error
|
||||
Init_Context( TT_ExecContext exec,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
|
||||
FT_TRACE1(( "Init_Context: new object at %p\n", (void *)exec ));
|
||||
|
||||
exec->memory = memory;
|
||||
exec->callSize = 32;
|
||||
|
||||
if ( FT_QNEW_ARRAY( exec->callStack, exec->callSize ) )
|
||||
goto Fail_Memory;
|
||||
|
||||
/* all values in the context are set to 0 already, but this is */
|
||||
/* here as a remainder */
|
||||
exec->maxPoints = 0;
|
||||
exec->maxContours = 0;
|
||||
|
||||
exec->stackSize = 0;
|
||||
exec->glyphSize = 0;
|
||||
|
||||
exec->stack = NULL;
|
||||
exec->glyphIns = NULL;
|
||||
|
||||
exec->face = NULL;
|
||||
exec->size = NULL;
|
||||
|
||||
return FT_Err_Ok;
|
||||
|
||||
Fail_Memory:
|
||||
FT_ERROR(( "Init_Context: not enough memory for %p\n", (void *)exec ));
|
||||
TT_Done_Context( exec );
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @Function:
|
||||
|
@ -617,19 +559,19 @@
|
|||
|
||||
memory = driver->root.root.memory;
|
||||
|
||||
/* allocate object */
|
||||
/* allocate object and zero everything inside */
|
||||
if ( FT_NEW( exec ) )
|
||||
goto Fail;
|
||||
|
||||
/* initialize it; in case of error this deallocates `exec' too */
|
||||
error = Init_Context( exec, memory );
|
||||
if ( error )
|
||||
goto Fail;
|
||||
/* create callStack here, other allocations delayed */
|
||||
exec->memory = memory;
|
||||
exec->callSize = 32;
|
||||
|
||||
return exec;
|
||||
if ( FT_QNEW_ARRAY( exec->callStack, exec->callSize ) )
|
||||
FT_FREE( exec );
|
||||
|
||||
Fail:
|
||||
return NULL;
|
||||
return exec;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue