]> granicus.if.org Git - graphviz/commitdiff
use a stronger return type in directVis
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 6 Jun 2021 02:33:46 +0000 (19:33 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 9 Jun 2021 00:09:34 +0000 (17:09 -0700)
lib/pathplan/vis.h
lib/pathplan/visibility.c

index f637dcf274bf93093cbe4e6b0fc7a00cd0600180..13c5546b20d3c98f97797631149c8e2cf87b228b 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <assert.h>
 #include <math.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <limits.h>
 #include "vispath.h"
@@ -45,7 +46,7 @@ extern "C" {
 /*end visual studio*/
 
        extern COORD *ptVis(vconfig_t *, int, Ppoint_t);
-    extern int directVis(Ppoint_t, int, Ppoint_t, int, vconfig_t *);
+    extern bool directVis(Ppoint_t, int, Ppoint_t, int, vconfig_t *);
     extern void visibility(vconfig_t *);
     extern int *makePath(Ppoint_t p, int pp, COORD * pvis,
                         Ppoint_t q, int qp, COORD * qvis,
index 896b77e4c3dbe0bff4a726a36b68a34ce49ee16c..bbe54da94c2b7960b51d8d24e95642c959030a5a 100644 (file)
@@ -358,7 +358,7 @@ COORD *ptVis(vconfig_t * conf, int pp, Ppoint_t p)
  * If a point is associated with a polygon, the edges of the polygon
  * are ignored when checking visibility.
  */
-int directVis(Ppoint_t p, int pp, Ppoint_t q, int qp, vconfig_t * conf)
+bool directVis(Ppoint_t p, int pp, Ppoint_t q, int qp, vconfig_t * conf)
 {
     int V = conf->N;
     Ppoint_t *pts = conf->P;
@@ -396,15 +396,15 @@ int directVis(Ppoint_t p, int pp, Ppoint_t q, int qp, vconfig_t * conf)
 
     for (k = 0; k < s1; k++) {
        if (INTERSECT(p, q, pts[k], pts[nextPt[k]], pts[prevPt[k]]))
-           return 0;
+           return false;
     }
     for (k = e1; k < s2; k++) {
        if (INTERSECT(p, q, pts[k], pts[nextPt[k]], pts[prevPt[k]]))
-           return 0;
+           return false;
     }
     for (k = e2; k < V; k++) {
        if (INTERSECT(p, q, pts[k], pts[nextPt[k]], pts[prevPt[k]]))
-           return 0;
+           return false;
     }
-    return 1;
+    return true;
 }