]> granicus.if.org Git - postgis/commitdiff
Fix initialization nit for @ustrk
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 24 Feb 2016 17:18:09 +0000 (17:18 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 24 Feb 2016 17:18:09 +0000 (17:18 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@14689 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwkmeans.c

index 11208fced211c70a7120da6372ece00c5890cd42..10a7d2ad557feae0d7ddaab47ad6670cb382172f 100644 (file)
@@ -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;
                }