From 2d025595f5465a91becba8ea34dae6214d11661d Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 19 Nov 2022 16:12:46 -0800 Subject: [PATCH] neatogen sortSites: use a clearer iteration idiom --- lib/neatogen/adjust.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/neatogen/adjust.c b/lib/neatogen/adjust.c index 7ede420fa..092fb779c 100644 --- a/lib/neatogen/adjust.c +++ b/lib/neatogen/adjust.c @@ -195,22 +195,17 @@ static int scomp(const void *S1, const void *S2) */ static void sortSites(void) { - Site **sp; - Info_t *ip; - if (sites == 0) { sites = gv_calloc(nsites, sizeof(Site*)); endSite = sites + nsites; } - sp = sites; - ip = nodeInfo; infoinit(); for (size_t i = 0; i < nsites; i++) { - *sp++ = &ip->site; + Info_t *ip = &nodeInfo[i]; + sites[i] = &ip->site; ip->verts = NULL; ip->site.refcnt = 1; - ip++; } qsort(sites, nsites, sizeof(Site *), scomp); -- 2.40.0