From e76dc5bf715a88bb48ded12528285aeeda66c792 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 8 Jan 2022 10:47:32 -0800 Subject: [PATCH] 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 --- lib/mingle/nearest_neighbor_graph.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); -- 2.40.0