* src/sdf/ftsdf.c (sdf_*_to): Remover redundant checks.

Fixes #1417, found by `cppcheck`.
This commit is contained in:
Alexei Podtelezhnikov 2026-04-12 22:34:21 -04:00
parent ca53609f3c
commit 18a463c2fb

View file

@ -655,12 +655,6 @@
FT_Memory memory = shape->memory;
if ( !to || !user )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
}
FT_CALL( sdf_contour_new( memory, &contour ) );
contour->last_pos = *to;
@ -679,21 +673,14 @@
sdf_line_to( const FT_26D6_Vec* to,
void* user )
{
SDF_Shape* shape = ( SDF_Shape* )user;
SDF_Edge* edge = NULL;
SDF_Contour* contour = NULL;
SDF_Shape* shape = ( SDF_Shape* )user;
SDF_Edge* edge = NULL;
SDF_Contour* contour = shape->contours;
FT_Error error = FT_Err_Ok;
FT_Memory memory = shape->memory;
FT_Error error = FT_Err_Ok;
FT_Memory memory = shape->memory;
if ( !to || !user )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
}
contour = shape->contours;
if ( contour->last_pos.x == to->x &&
contour->last_pos.y == to->y )
@ -722,22 +709,14 @@
const FT_26D6_Vec* to,
void* user )
{
SDF_Shape* shape = ( SDF_Shape* )user;
SDF_Edge* edge = NULL;
SDF_Contour* contour = NULL;
SDF_Shape* shape = ( SDF_Shape* )user;
SDF_Edge* edge = NULL;
SDF_Contour* contour = shape->contours;
FT_Error error = FT_Err_Ok;
FT_Memory memory = shape->memory;
if ( !control_1 || !to || !user )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
}
contour = shape->contours;
/* If the control point coincides with any of the end points */
/* then it is a line and should be treated as one to avoid */
/* unnecessary complexity later in the algorithm. */
@ -778,20 +757,12 @@
{
SDF_Shape* shape = ( SDF_Shape* )user;
SDF_Edge* edge = NULL;
SDF_Contour* contour = NULL;
SDF_Contour* contour = shape->contours;
FT_Error error = FT_Err_Ok;
FT_Memory memory = shape->memory;
if ( !control_2 || !control_1 || !to || !user )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
}
contour = shape->contours;
FT_CALL( sdf_edge_new( memory, &edge ) );
edge->edge_type = SDF_EDGE_CUBIC;