Commit a2ec60a8 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

remap_distwgt.c: allocate dist and adds on the stack

parent e2ef3895
...@@ -290,8 +290,8 @@ void grid_search_nbr(struct gridsearch *gs, int num_neighbors, int *restrict nbr ...@@ -290,8 +290,8 @@ void grid_search_nbr(struct gridsearch *gs, int num_neighbors, int *restrict nbr
int ndist = num_neighbors; int ndist = num_neighbors;
ndist = ndist*2; // check some more points if distance is the same use the smaller index (nadd) ndist = ndist*2; // check some more points if distance is the same use the smaller index (nadd)
double *dist = (double *) Malloc(ndist*sizeof(double)); double dist[ndist];
int *adds = (int *) Malloc(ndist*sizeof(int)); int adds[ndist];
const double range0 = SQR(2*search_radius); const double range0 = SQR(2*search_radius);
double range = range0; double range = range0;
...@@ -341,9 +341,6 @@ void grid_search_nbr(struct gridsearch *gs, int num_neighbors, int *restrict nbr ...@@ -341,9 +341,6 @@ void grid_search_nbr(struct gridsearch *gs, int num_neighbors, int *restrict nbr
for ( j = 0; j < ndist; ++j ) for ( j = 0; j < ndist; ++j )
nbr_store_distance(adds[j], dist[j], num_neighbors, nbr_add, nbr_dist); nbr_store_distance(adds[j], dist[j], num_neighbors, nbr_add, nbr_dist);
Free(adds);
Free(dist);
nbr_check_distance(num_neighbors, nbr_add, nbr_dist); nbr_check_distance(num_neighbors, nbr_add, nbr_dist);
} /* grid_search_nbr */ } /* grid_search_nbr */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment