From b79138a54ffcdef969a93dd0fac01c0a06a2aa78 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Wed, 30 Nov 2022 17:10:49 -0800 Subject: [PATCH] patchwork: replace 'rectangle_new' with C99 initialization --- lib/patchwork/patchwork.c | 2 +- lib/patchwork/tree_map.c | 12 ------------ lib/patchwork/tree_map.h | 2 -- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/patchwork/patchwork.c b/lib/patchwork/patchwork.c index 22e2c6d1e..48f93376d 100644 --- a/lib/patchwork/patchwork.c +++ b/lib/patchwork/patchwork.c @@ -280,7 +280,7 @@ void patchworkLayout(Agraph_t * g) root = mkTree (g,gp,ap,mp); total = root->area; - root->r = rectangle_new(0, 0, sqrt(total + 0.1), sqrt(total + 0.1)); + root->r = (rectangle){{0, 0}, {sqrt(total + 0.1), sqrt(total + 0.1)}}; layoutTree(root); walkTree(root); freeTree (root); diff --git a/lib/patchwork/tree_map.c b/lib/patchwork/tree_map.c index 561b639b5..9be723d4e 100644 --- a/lib/patchwork/tree_map.c +++ b/lib/patchwork/tree_map.c @@ -111,15 +111,3 @@ rectangle* tree_map(int n, double *area, rectangle fillrec){ squarify(n, area, recs, nadded, maxarea, minarea, totalarea, asp, fillrec); return recs; } - -/* rectangle_new: - * Create and initialize a new rectangle structure - */ -rectangle rectangle_new(double x, double y, double width, double height){ - rectangle r; - r.x[0] = x; - r.x[1] = y; - r.size[0] = width; - r.size[1] = height; - return r; -} diff --git a/lib/patchwork/tree_map.h b/lib/patchwork/tree_map.h index e2570db64..bc4f35b44 100644 --- a/lib/patchwork/tree_map.h +++ b/lib/patchwork/tree_map.h @@ -18,5 +18,3 @@ typedef struct { } rectangle; extern rectangle* tree_map(int n, double *area, rectangle fillrec); - -extern rectangle rectangle_new(double x, double y, double width, double height); -- 2.40.0