From: Matthew Fernandez Date: Sat, 24 Apr 2021 03:10:42 +0000 (-0700) Subject: fix: return -2 on error in seg_cmp and remove now unused longjmp path X-Git-Tag: 2.47.2~13^2~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24ff9fbedf6753443c7e2517acf03e6d4ed4798f;p=graphviz fix: return -2 on error in seg_cmp and remove now unused longjmp path Related to #1801. This removes two (accurate) warnings about possible clobbered variables in orthoEdges. --- diff --git a/lib/ortho/ortho.c b/lib/ortho/ortho.c index 7926b5929..463b7b776 100644 --- a/lib/ortho/ortho.c +++ b/lib/ortho/ortho.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -39,8 +38,6 @@ typedef struct { Agedge_t* e; } epair_t; -static jmp_buf jbuf; - #ifdef DEBUG static void emitSearchGraph (FILE* fp, sgraph* sg); static void emitGraph (FILE* fp, maze* mp, size_t n_edges, route* route_list, epair_t[]); @@ -723,6 +720,7 @@ segCmp (segment* S1, segment* S2, bend T1, bend T2) * 0 if a crossing is unavoidable or there is no crossing at all or * the segments are parallel, * 1 if S1 HAS TO BE to the left/above S2 to avoid a crossing + * -2 if S1 and S2 are incomparable * * Note: This definition means horizontal segments have track numbers * increasing as y decreases, while vertical segments have track numbers @@ -737,7 +735,7 @@ seg_cmp(segment* S1, segment* S2) { if(S1->isVert!=S2->isVert||S1->comm_coord!=S2->comm_coord) { agerr (AGERR, "incomparable segments !! -- Aborting\n"); - longjmp(jbuf, 1); + return -2; } if(S1->isVert) return segCmp (S1, S2, B_RIGHT, B_LEFT); @@ -1365,8 +1363,6 @@ orthoEdges (Agraph_t* g, int doLbls) mp->hchans = extractHChans (mp); mp->vchans = extractVChans (mp); assignSegs (n_edges, route_list, mp); - if (setjmp(jbuf)) - goto orthofinish; if (assignTracks(mp) != 0) goto orthofinish; #ifdef DEBUG