From 18a463c2fbfc03ab8adf9d4bdc14716ba9b413db Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 12 Apr 2026 22:34:21 -0400 Subject: [PATCH] * src/sdf/ftsdf.c (sdf_*_to): Remover redundant checks. Fixes #1417, found by `cppcheck`. --- src/sdf/ftsdf.c | 47 +++++++++-------------------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c index e86b99594..48deb5469 100644 --- a/src/sdf/ftsdf.c +++ b/src/sdf/ftsdf.c @@ -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;