From 664b9fb7eb68ea83a67ad5ed37bdf04eb90c9434 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 17 Jun 2021 18:16:35 -0700 Subject: [PATCH] abbreviate open coded fmax and fmin operations in pswrite --- lib/fdpgen/dbg.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/fdpgen/dbg.c b/lib/fdpgen/dbg.c index 232d6735e..3677ab90c 100644 --- a/lib/fdpgen/dbg.c +++ b/lib/fdpgen/dbg.c @@ -267,14 +267,10 @@ static void pswrite(Agraph_t * g, FILE * fp, int expMode) maxy = ND_pos(n)[1]; n = agnxtnode(g, n); for (; n; n = agnxtnode(g, n)) { - if (ND_pos(n)[0] < minx) - minx = ND_pos(n)[0]; - if (ND_pos(n)[1] < miny) - miny = ND_pos(n)[1]; - if (ND_pos(n)[0] > maxx) - maxx = ND_pos(n)[0]; - if (ND_pos(n)[1] > maxy) - maxy = ND_pos(n)[1]; + minx = fmin(minx, ND_pos(n)[0]); + miny = fmin(miny, ND_pos(n)[1]); + maxx = fmax(maxx, ND_pos(n)[0]); + maxy = fmax(maxy, ND_pos(n)[1]); } /* Convert to points @@ -302,10 +298,7 @@ static void pswrite(Agraph_t * g, FILE * fp, int expMode) height = maxy - miny + 20; if (width > PSWidth) { if (height > PSHeight) { - scale = - PSWidth / width < - PSHeight / height ? PSWidth / width : PSHeight / - height; + scale = fmin(PSWidth / width, PSHeight / height); } else scale = PSWidth / width; } else if (height > PSHeight) { -- 2.40.0