From eaca20f1e66c83ce16a449bd3daedb373d3a1d3b Mon Sep 17 00:00:00 2001 From: Jitendar Kumar Date: Wed, 22 Apr 2015 11:48:39 +0530 Subject: [PATCH] Remove Deadcode in gd.c In API gdImageLine() if `dx == 0` Checked and return else if `dy==0` Checked and return. if ((dx == 0) && (dy == 0)) never TRUE , code has no impact , can be removed. --- src/gd.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/gd.c b/src/gd.c index b7eb908..ffdd59e 100644 --- a/src/gd.c +++ b/src/gd.c @@ -1325,20 +1325,17 @@ BGD_DECLARE(void) gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, in if (dy <= dx) { /* More-or-less horizontal. use wid for vertical stroke */ /* Doug Claar: watch out for NaN in atan2 (2.0.5) */ - if ((dx == 0) && (dy == 0)) { - wid = 1; + + /* 2.0.12: Michael Schwartz: divide rather than multiply; + TBB: but watch out for /0! */ + double ac = cos (atan2 (dy, dx)); + if (ac != 0) { + wid = thick / ac; } else { - /* 2.0.12: Michael Schwartz: divide rather than multiply; - TBB: but watch out for /0! */ - double ac = cos (atan2 (dy, dx)); - if (ac != 0) { - wid = thick / ac; - } else { - wid = 1; - } - if (wid == 0) { - wid = 1; - } + wid = 1; + } + if (wid == 0) { + wid = 1; } d = 2 * dy - dx; incr1 = 2 * dy;