From: Matthew Fernandez Date: Sat, 8 Jan 2022 18:47:32 +0000 (-0800) Subject: nearest_neighbor_graph: cast the result of calls to 'malloc' X-Git-Tag: 3.0.0~74^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e76dc5bf715a88bb48ded12528285aeeda66c792;p=graphviz nearest_neighbor_graph: cast the result of calls to 'malloc' This pre-emptively suppresses some `-fpermissive` warnings when transitioning this code to C++ in an upcoming commit. Gitlab: #2154 --- diff --git a/lib/mingle/nearest_neighbor_graph.c b/lib/mingle/nearest_neighbor_graph.c index 1de680376..b74e3dbdf 100644 --- a/lib/mingle/nearest_neighbor_graph.c +++ b/lib/mingle/nearest_neighbor_graph.c @@ -32,9 +32,9 @@ SparseMatrix nearest_neighbor_graph(int nPts, int num_neigbors, double *x, doubl int k = num_neigbors; /* need to *2 as we do two sweeps of neighbors, so could have repeats */ - irn = MALLOC(sizeof(int)*nPts*k*2); - jcn = MALLOC(sizeof(int)*nPts*k*2); - val = MALLOC(sizeof(double)*nPts*k*2); + irn = (int*)MALLOC(sizeof(int)*nPts*k*2); + jcn = (int*)MALLOC(sizeof(int)*nPts*k*2); + val = (double*)MALLOC(sizeof(double)*nPts*k*2); #ifdef HAVE_ANN nearest_neighbor_graph_ann(nPts, num_neigbors, eps, x, &nz, &irn, &jcn, &val);