From: Matthew Fernandez Date: Thu, 24 Nov 2022 17:31:02 +0000 (-0800) Subject: ortho monotonate_trapezoids: allocate structures based on trapezoid count X-Git-Tag: 7.0.4~2^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1a4b283356d285e3a8d76e2bbc2555b7cd24f86;p=graphviz ortho monotonate_trapezoids: allocate structures based on trapezoid count `tr->length` and `TRSIZE(nsegs)` are the same value here, so this has no immediate effect. This is a step towards moving to on-demand allocation. Gitlab: #56 --- diff --git a/lib/ortho/partition.c b/lib/ortho/partition.c index 0c61fc9ba..adbc6e4ae 100644 --- a/lib/ortho/partition.c +++ b/lib/ortho/partition.c @@ -596,16 +596,15 @@ monotonate_trapezoids(int nsegs, segment_t *seg, traps_t *tr, { int i, size; int tr_start; - int tr_size = TRSIZE(nsegs); - int* visited = gv_calloc(tr_size, sizeof(int)); + int* visited = gv_calloc(tr->length, sizeof(int)); - mchain = gv_calloc(tr_size, sizeof(monchain_t)); + mchain = gv_calloc(tr->length, sizeof(monchain_t)); vert = gv_calloc(nsegs + 1, sizeof(vertexchain_t)); mon = gv_calloc(nsegs, sizeof(int)); /* First locate a trapezoid which lies inside the polygon */ /* and which is triangular */ - for (i = 0; i < TRSIZE(nsegs); i++) + for (i = 0; i < tr->length; i++) if (inside_polygon(&tr->data[i], seg)) break; tr_start = i;