From: Matthew Fernandez Date: Sat, 26 Nov 2022 17:07:25 +0000 (-0800) Subject: dotgen: simplify 'makeregularend' X-Git-Tag: 7.0.4~4^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0d752ed868807b12f8fa8a22c2194821ed35001;p=graphviz dotgen: simplify 'makeregularend' This function is only called with `BOTTOM` and `TOP`, so we can abbreviate it squashing a -Wswitch-default warning. --- diff --git a/lib/dotgen/dotsplines.c b/lib/dotgen/dotsplines.c index 25de5d47d..fa917c5cd 100644 --- a/lib/dotgen/dotsplines.c +++ b/lib/dotgen/dotsplines.c @@ -2175,16 +2175,11 @@ completeregularpath(path * P, edge_t * first, edge_t * last, */ static boxf makeregularend(boxf b, int side, double y) { - boxf newb; - switch (side) { - case BOTTOM: - newb = boxfof(b.LL.x, y, b.UR.x, b.LL.y); - break; - case TOP: - newb = boxfof(b.LL.x, b.UR.y, b.UR.x, y); - break; - } - return newb; + assert(side == BOTTOM || side == TOP); + if (side == BOTTOM) { + return boxfof(b.LL.x, y, b.UR.x, b.LL.y); + } + return boxfof(b.LL.x, b.UR.y, b.UR.x, y); } #ifndef DONT_WANT_ANY_ENDPOINT_PATH_REFINEMENT