From 1d1193963f92abb447770d066bc53edd25da7995 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Wed, 24 Feb 2016 17:18:09 +0000 Subject: [PATCH] Fix initialization nit for @ustrk git-svn-id: http://svn.osgeo.org/postgis/trunk@14689 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/lwkmeans.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/liblwgeom/lwkmeans.c b/liblwgeom/lwkmeans.c index 11208fced..10a7d2ad5 100644 --- a/liblwgeom/lwkmeans.c +++ b/liblwgeom/lwkmeans.c @@ -85,6 +85,7 @@ lwgeom_cluster_2d_kmeans(const LWGEOM **geoms, int ngeoms, int k) kmeans_result result; int *seen; int sidx = 0; + int initialized = 0; assert(k>0); assert(ngeoms>0); @@ -149,8 +150,9 @@ lwgeom_cluster_2d_kmeans(const LWGEOM **geoms, int ngeoms, int k) config.objs[i] = (Pointer)cp; /* Since we're already here, let's calculate the extrema of the set */ - if (i == 0) + if (!initialized) { + initialized = 1; min = *cp; max = *cp; } -- 2.40.0