From 4f69abdbb665362acaf783febc270fbe2c3df1c7 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 19 Nov 2022 16:15:33 -0800 Subject: [PATCH] neatogen geomUpdate: use a clearer iteration idiom --- lib/neatogen/adjust.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/neatogen/adjust.c b/lib/neatogen/adjust.c index 092fb779c..44336995d 100644 --- a/lib/neatogen/adjust.c +++ b/lib/neatogen/adjust.c @@ -221,9 +221,10 @@ static void geomUpdate(int doSort) sortSites(); /* compute ranges */ - xmin = sites[0]->coord.x; - xmax = sites[0]->coord.x; - for (size_t i = 1; i < nsites; i++) { + xmin = DBL_MAX; + xmax = -DBL_MAX; + assert(nsites > 0); + for (size_t i = 0; i < nsites; ++i) { xmin = fmin(xmin, sites[i]->coord.x); xmax = fmax(xmax, sites[i]->coord.x); } -- 2.40.0