From: Matthew Fernandez Date: Sun, 19 Dec 2021 19:17:59 +0000 (-0800) Subject: dijkstra: remove use of raw 'INT_MAX' X-Git-Tag: 3.0.0~120^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd175d3ed799854f4805188fcc9c0f06930d9b72;p=graphviz dijkstra: remove use of raw 'INT_MAX' This code was relying on this value being the same as `DIST_MAX`. `DIST_MAX` is currently set to `INT_MAX`, but using `INT_MAX` directly here implied it was safe to change the definition of `DIST_MAX` without updating this location, which was not true. --- diff --git a/lib/neatogen/dijkstra.c b/lib/neatogen/dijkstra.c index a4f4d8273..f524d569d 100644 --- a/lib/neatogen/dijkstra.c +++ b/lib/neatogen/dijkstra.c @@ -139,7 +139,7 @@ void dijkstra(int vertex, vtx_data * graph, int n, DistType * dist) int i; heap H; int closestVertex, neighbor; - DistType closestDist, prevClosestDist = INT_MAX; + DistType closestDist, prevClosestDist = MAX_DIST; static int *index; index = realloc(index, n * sizeof(int));