]> granicus.if.org Git - graphviz/commitdiff
eliminate MAXINT - use standard INT_MAX instead
authorellson <devnull@localhost>
Sat, 8 Jul 2006 20:42:53 +0000 (20:42 +0000)
committerellson <devnull@localhost>
Sat, 8 Jul 2006 20:42:53 +0000 (20:42 +0000)
lib/common/arith.h
lib/common/htmltable.c
lib/common/ns.c
lib/common/shapes.c
lib/common/utils.c
lib/dotgen/mincross.c
lib/dotgen/position.c
lib/dotgen/rank.c
lib/neatogen/bfs.c
lib/neatogen/constraint.c
lib/neatogen/dijkstra.c

index efb3dbbaae41744fc59fead22b37e1531fb31345..d60160d6e03ecbf02ee02ed58b4b214460b868ab 100644 (file)
@@ -54,17 +54,24 @@ extern "C" {
 #endif
 #define ABS(a)         ((a) >= 0 ? (a) : -(a))
 
-#ifndef MAXINT
-#define        MAXINT          ((int)(~(unsigned)0 >> 1))
+#ifndef INT_MAX
+#define        INT_MAX         ((int)(~(unsigned)0 >> 1))
 #endif
+
+#ifndef INT_MIN
+#define INT_MIN                (-INT_MAX - 1)
+#endif
+
 #ifndef MAXSHORT
 #define        MAXSHORT        (0x7fff)
 #endif
+
 #ifndef MAXDOUBLE
-#define MAXDOUBLE   1.7976931348623157e+308
+#define MAXDOUBLE      1.7976931348623157e+308
 #endif
+
 #ifndef MAXFLOAT
-#define MAXFLOAT   ((float)3.40282347e+38)
+#define MAXFLOAT       ((float)3.40282347e+38)
 #endif
 
 #ifdef BETWEEN
@@ -73,10 +80,11 @@ extern "C" {
 #define BETWEEN(a,b,c) (((a) <= (b)) && ((b) <= (c)))
 
 #ifndef M_PI
-#define M_PI 3.14159265358979323846
+#define M_PI           3.14159265358979323846
 #endif
+
 #ifndef PI
-#define PI M_PI
+#define PI             M_PI
 #endif
 
 #define ROUND(f)        ((f>=0)?(int)(f + .5):(int)(f - .5))
index 5b8cba9fce741808a33e21447223610b9a6d68ed..4cf382729a15cae3c635b83c5b0b3a35176b07b7 100644 (file)
@@ -1253,8 +1253,8 @@ void sizeArray(htmltbl_t * tbl)
     rowg = agopen("rowg", AGDIGRAPH);
     colg = agopen("colg", AGDIGRAPH);
     makeGraphs(tbl, rowg, colg);
-    rank(rowg, 2, MAXINT);
-    rank(colg, 2, MAXINT);
+    rank(rowg, 2, INT_MAX);
+    rank(colg, 2, INT_MAX);
     setSizes(tbl, rowg, colg);
     closeGraphs(rowg, colg);
 }
index 03d7a1f7c6165a4bd5ed0097c36418b064ad0626..6035937b6bd4603af951db79f199eac8aeff3a57 100644 (file)
@@ -244,7 +244,7 @@ static edge_t *enter_edge(edge_t * e)
        outsearch = TRUE;
     }
     Enter = NULL;
-    Slack = MAXINT;
+    Slack = INT_MAX;
     Low = ND_low(v);
     Lim = ND_lim(v);
     if (outsearch)
@@ -428,8 +428,8 @@ static void scan_and_normalize(void)
 {
     node_t *n;
 
-    Minrank = MAXINT;
-    Maxrank = -MAXINT;
+    Minrank = INT_MAX;
+    Maxrank = -INT_MAX;
     for (n = GD_nlist(G); n; n = ND_next(n)) {
        if (ND_node_type(n) == NORMAL) {
            Minrank = MIN(Minrank, ND_rank(n));
index 465d60ed5a4b5cd829546906f84f8b38f46a62d3..a029454620ea0fa5b4f668403953f435f55508ee 100644 (file)
@@ -1066,14 +1066,14 @@ compassPort(node_t* n, box* bp, port* pp, char* compass, int sides, inside_t* ic
            case 'e':
                theta = -PI * 0.25;
                defined = TRUE;
-               if (ictxt) p = compassPoint (ictxt, -MAXINT, MAXINT);
+               if (ictxt) p = compassPoint (ictxt, -INT_MAX, INT_MAX);
                else p.x = b.UR.x;
                side = sides & (BOTTOM | RIGHT);
                break;
            case 'w':
                theta = -PI * 0.75;
                defined = TRUE;
-               if (ictxt) p = compassPoint (ictxt, -MAXINT, -MAXINT);
+               if (ictxt) p = compassPoint (ictxt, -INT_MAX, -INT_MAX);
                else p.x = b.LL.x;
                side = sides & (BOTTOM | LEFT);
                break;
@@ -1106,14 +1106,14 @@ compassPort(node_t* n, box* bp, port* pp, char* compass, int sides, inside_t* ic
            case 'e':
                defined = TRUE;
                theta = PI * 0.25;
-               if (ictxt) p = compassPoint (ictxt, MAXINT, MAXINT);
+               if (ictxt) p = compassPoint (ictxt, INT_MAX, INT_MAX);
                else p.x = b.UR.x;
                side = sides & (TOP | RIGHT);
                break;
            case 'w':
                defined = TRUE;
                theta = PI * 0.75;
-               if (ictxt) p = compassPoint (ictxt, MAXINT, -MAXINT);
+               if (ictxt) p = compassPoint (ictxt, INT_MAX, -INT_MAX);
                else p.x = b.LL.x;
                side = sides & (TOP | LEFT);
                break;
index e2e43177883dbd67cbbd92d2690df15d6e3d2583..0e7a2449701f71f020b80abfb6513285a994e504 100644 (file)
@@ -846,8 +846,8 @@ void compute_bb(graph_t * g)
     point pt, s2;
     int i, j;
 
-    bb.LL = pointof(MAXINT, MAXINT);
-    bb.UR = pointof(-MAXINT, -MAXINT);
+    bb.LL = pointof(INT_MAX, INT_MAX);
+    bb.UR = pointof(-INT_MAX, -INT_MAX);
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
        pt = coord(n);
        s2.x = ND_xsize(n) / 2 + 1;
index bdccada70547853d98fe8af394a0d1a99ec97fe0..d16159b9f890be136ce34837de2f53f54d8593b6 100644 (file)
@@ -414,7 +414,7 @@ static int mincross(graph_t * g, int startpass, int endpass)
        cur_cross = best_cross = ncross(g);
        save_best(g);
     } else
-       cur_cross = best_cross = MAXINT;
+       cur_cross = best_cross = INT_MAX;
     for (pass = startpass; pass <= endpass; pass++) {
        if (pass <= 1) {
            maxthispass = MIN(4, MaxIter);
index 688b2112384d1b4f9b03da96e53cdc9d8ad4bb1c..0ab7d9ecd01bd97c8bdda09e5942442e874fe056 100644 (file)
@@ -136,7 +136,7 @@ void dot_position(graph_t * g)
 
 static int nsiter2(graph_t * g)
 {
-    int maxiter = MAXINT;
+    int maxiter = INT_MAX;
     char *s;
 
     if ((s = agget(g, "nslimit")))
@@ -864,8 +864,8 @@ static void dot_compute_bb(graph_t * g, graph_t * root)
     point LL, UR;
 
     if (g == g->root) {
-       LL.x = MAXINT;
-       UR.x = -MAXINT;
+       LL.x = INT_MAX;
+       UR.x = -INT_MAX;
        for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
            if (GD_rank(g)[r].n == 0)
                continue;
index 3363089b52a3f2ac58e18513fc3a1ffc92a66f35..8c05f28678f168d9aff47d8746d8a917dee0203d 100644 (file)
@@ -383,7 +383,7 @@ minmax_edges2(graph_t * g, point slen)
 static void 
 rank1(graph_t * g)
 {
-    int maxiter = MAXINT;
+    int maxiter = INT_MAX;
     int c;
     char *s;
 
index 28987213694e0235a0a41a9e64ba97aefbfdaa18..b1a9933b935a77a45765003a11c04412c8537246 100644 (file)
@@ -32,7 +32,7 @@ void bfs(int vertex, vtx_data * graph, int n, DistType * dist, Queue * Q)
 {
     int i;
     int closestVertex, neighbor;
-    DistType closestDist = MAXINT;
+    DistType closestDist = INT_MAX;
 
     /* initial distances with edge weights: */
     for (i = 0; i < n; i++)
index bb900a5a88d86c85e7712f7794b7e721457100f3..1d84c297a8c69cd2cb5472fad47673f4cb6f2139 100644 (file)
@@ -306,7 +306,7 @@ static graph_t *mkConstraintG(graph_t * g, Dt_t * list,
     node_t *n = NULL;
     edge_t *e;
     int lcnt, cnt;
-    int oldval = -MAXINT;
+    int oldval = -INT_MAX;
 #ifdef OLD
     double root_val;
 #endif
@@ -323,7 +323,7 @@ static graph_t *mkConstraintG(graph_t * g, Dt_t * list,
     }
 
     /* construct basic chain to enforce left to right order */
-    oldval = -MAXINT;
+    oldval = -INT_MAX;
     lcnt = 0;
     for (p = (nitem *) dtflatten(list); p;
         p = (nitem *) dtlink(list, (Dtlink_t *) p)) {
@@ -373,7 +373,7 @@ static graph_t *mkConstraintG(graph_t * g, Dt_t * list,
        p->vnode = n;
        ND_alg(n) = p;
     }
-    oldval = -MAXINT;
+    oldval = -INT_MAX;
     for (p = (nitem *) dtflatten(list); p;
         p = (nitem *) dtlink(list, (Dtlink_t *) p)) {
        if (oldval != p->val) { /* new pos: reset nxt */
@@ -470,7 +470,7 @@ static void constrainX(graph_t* g, nitem* nlist, int nnodes, intersectfn ifn,
        cg = mkConstraintG(g, list, ifn, distX);
     else
        cg = mkNConstraintG(g, list, ifn, distX);
-    rank(cg, 2, MAXINT);
+    rank(cg, 2, INT_MAX);
 
     p = nlist;
     for (i = 0; i < nnodes; i++) {
@@ -508,7 +508,7 @@ static void constrainY(graph_t* g, nitem* nlist, int nnodes, intersectfn ifn,
        cg = mkConstraintG(g, list, ifn, distY);
     else
        cg = mkNConstraintG(g, list, ifn, distY);
-    rank(cg, 2, MAXINT);
+    rank(cg, 2, INT_MAX);
 #ifdef DEBUG
     {
        Agsym_t *mlsym = agedgeattr(cg, "minlen", "");
index 5d37ec0f346844bd92ceb179c54992e6e6ae8ab8..d6e6761cce7d5a9345f1e59c4e573dae5525fee7 100644 (file)
@@ -160,7 +160,7 @@ void dijkstra(int vertex, vtx_data * graph, int n, DistType * dist)
     int i;
     heap H;
     int closestVertex, neighbor;
-    DistType closestDist, prevClosestDist = MAXINT;
+    DistType closestDist, prevClosestDist = INT_MAX;
     static int *index;
 
 #ifdef OBSOLETE