summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexei Podtelezhnikov <apodtele@gmail.com>2021-09-13 00:04:45 -0400
committerAlexei Podtelezhnikov <apodtele@gmail.com>2021-09-13 00:04:45 -0400
commit073ff2d77e31cc256a2ed3ba78ba4d6f1fda26e2 (patch)
treeb3060ab9dcd8e725d7229dbf3a88c04bc09132a4
parentfab94f9fccce248334b9b1f30b5996b69230ebe1 (diff)
downloadfreetype2-073ff2d77e31cc256a2ed3ba78ba4d6f1fda26e2.tar.gz
[truetype] Clean up `exec` initialization.
* src/truetype/ttinterp.c (Init_Context): Absorbed into... (TT_New_Context): ... this function.
-rw-r--r--src/truetype/ttinterp.c72
1 files changed, 7 insertions, 65 deletions
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 35ba626c7..82cd3bb53 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -278,64 +278,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:
* Update_Max
*
* @Description:
@@ -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;
}