]> granicus.if.org Git - graphviz/commitdiff
ortho: remove 'TRSIZE' and rely on trapezoid collection length
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 24 Nov 2022 16:54:06 +0000 (08:54 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 30 Nov 2022 04:04:18 +0000 (20:04 -0800)
We no longer need the global here. Apart from progress towards #56, this
makes progress towards thread-safety too.

Gitlab: #56

lib/ortho/trapezoid.c

index 4645ad4b0d85207b11cb50bc8300f33fb611a8da..8df98720db447b093b96aae6e4a0f8e2a3cba085 100644 (file)
@@ -57,7 +57,6 @@ typedef struct {
 static int q_idx;
 static int tr_idx;
 static int QSIZE;
-static int TRSIZE;
 
 /* Return a new node to be added into the query tree */
 static int newnode(void)
@@ -73,7 +72,7 @@ static int newnode(void)
 
 /* Return a free trapezoid */
 static int newtrap(traps_t *tr) {
-    if (tr_idx < TRSIZE) {
+    if (tr_idx < tr->length) {
        tr->data[tr_idx].lseg = -1;
        tr->data[tr_idx].rseg = -1;
        tr->data[tr_idx].state = ST_VALID;
@@ -1019,7 +1018,6 @@ construct_trapezoids(int nseg, segment_t *seg, int *permute, traps_t* tr) {
     qnode_t* qs;
 
     QSIZE = 2 * tr->length;
-    TRSIZE = tr->length;
     qs = gv_calloc(2 * tr->length, sizeof(qnode_t));
     q_idx = tr_idx = 1;
     memset(tr->data, 0, tr->length * sizeof(trap_t));