- #4172, Fix memory leak in lwgeom_offsetcurve (Raúl Marín)
- #4173, Fix undefined behaviour in ptarray_segmentize2d (Raúl Marín)
- #4176, ST_Intersects supports GEOMETRYCOLLECTION (Darafei Praliaskouski)
+ - #4177, Postgres 12 disallows variable length arrays in C (Laurenz Albe)
PostGIS 2.5.0rc1
2018/08/19
return ivol / vol2;
}
+/* How many bins shall we use in figuring out the distribution? */
+#define NUM_BINS 50
/**
* Calculate how much a set of boxes is homogenously distributed
static int
nd_box_array_distribution(const ND_BOX **nd_boxes, int num_boxes, const ND_BOX *extent, int ndims, double *distribution)
{
- /* How many bins shall we use in figuring out the distribution? */
- static int num_bins = 50;
int d, i, k, range;
- int counts[num_bins];
+ int counts[NUM_BINS];
double smin, smax; /* Spatial min, spatial max */
double swidth; /* Spatial width of dimension */
#if POSTGIS_DEBUG_LEVEL >= 3
for ( d = 0; d < ndims; d++ )
{
/* Initialize counts for this dimension */
- memset(counts, 0, sizeof(int)*num_bins);
+ memset(counts, 0, sizeof(int)*NUM_BINS);
smin = extent->min[d];
smax = extent->max[d];
}
/* What bins does this range correspond to? */
- bmin = num_bins * (minoffset) / swidth;
- bmax = num_bins * (maxoffset) / swidth;
+ bmin = NUM_BINS * (minoffset) / swidth;
+ bmax = NUM_BINS * (maxoffset) / swidth;
POSTGIS_DEBUGF(4, " dimension %d, feature %d: bin %d to bin %d", d, i, bmin, bmax);
}
/* How dispersed is the distribution of features across bins? */
- range = range_quintile(counts, num_bins);
+ range = range_quintile(counts, NUM_BINS);
#if POSTGIS_DEBUG_LEVEL >= 3
- average = avg(counts, num_bins);
- sdev = stddev(counts, num_bins);
+ average = avg(counts, NUM_BINS);
+ sdev = stddev(counts, NUM_BINS);
sdev_ratio = sdev/average;
POSTGIS_DEBUGF(3, " dimension %d: range = %d", d, range);