From fd175d3ed799854f4805188fcc9c0f06930d9b72 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 19 Dec 2021 11:17:59 -0800 Subject: [PATCH] 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. --- lib/neatogen/dijkstra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); -- 2.40.0