]> granicus.if.org Git - graphviz/commitdiff
init_job_pagination: use fmax instead of open coding
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 30 Aug 2021 00:05:37 +0000 (17:05 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 4 Sep 2021 02:28:20 +0000 (19:28 -0700)
lib/common/emit.c

index f7afa1904f6d061262aa9ad949e8c7add269db5f..eba0f5515b49db73f7aca34ab55cfe343826641a 100644 (file)
@@ -1333,20 +1333,16 @@ static void init_job_pagination(GVJ_t * job, graph_t *g)
        /* page not set by user, use default from renderer */
        if (job->render.features) {
            pageSize.x = job->device.features->default_pagesize.x - 2*margin.x;
-           if (pageSize.x < 0.)
-               pageSize.x = 0.;
+           pageSize.x = fmax(pageSize.x, 0);
            pageSize.y = job->device.features->default_pagesize.y - 2*margin.y;
-           if (pageSize.y < 0.)
-               pageSize.y = 0.;
+           pageSize.y = fmax(pageSize.y, 0);
        }
        else
            pageSize.x = pageSize.y = 0.;
        job->pagesArraySize.x = job->pagesArraySize.y = job->numPages = 1;
         
-        if (pageSize.x < imageSize.x)
-           pageSize.x = imageSize.x;
-        if (pageSize.y < imageSize.y)
-           pageSize.y = imageSize.y;
+        pageSize.x = fmax(pageSize.x, imageSize.x);
+        pageSize.y = fmax(pageSize.y, imageSize.y);
     }
 
     /* initial window size */