ext/h3/src/src/apps/testapps/testH3Distance.c in h3-3.4.0 vs ext/h3/src/src/apps/testapps/testH3Distance.c in h3-3.4.4

- old
+ new

@@ -26,11 +26,10 @@ #include "baseCells.h" #include "constants.h" #include "h3Index.h" #include "h3api.h" #include "localij.h" -#include "stackAlloc.h" #include "test.h" #include "utility.h" static const int MAX_DISTANCES[] = {1, 2, 5, 12, 19, 26}; @@ -42,12 +41,12 @@ int r = H3_GET_RESOLUTION(h3); t_assert(r <= 5, "resolution supported by test function (kRing)"); int maxK = MAX_DISTANCES[r]; int sz = H3_EXPORT(maxKringSize)(maxK); - STACK_ARRAY_CALLOC(H3Index, neighbors, sz); - STACK_ARRAY_CALLOC(int, distances, sz); + H3Index *neighbors = calloc(sz, sizeof(H3Index)); + int *distances = calloc(sz, sizeof(int)); H3_EXPORT(kRingDistances)(h3, maxK, neighbors, distances); for (int i = 0; i < sz; i++) { if (neighbors[i] == 0) { @@ -59,9 +58,12 @@ // Don't consider indexes where h3Distance reports failure to // generate t_assert(calculatedDistance == distances[i] || calculatedDistance == -1, "kRingDistances matches h3Distance"); } + + free(distances); + free(neighbors); } SUITE(h3Distance) { // Some indexes that represent base cells. Base cells // are hexagons except for `pent1`.