[postgis-tickets] r15131 - Simplify loop / make more readable

Sandro Santilli strk at kbt.io
Fri Sep 23 10:38:31 PDT 2016


Author: strk
Date: 2016-09-23 10:38:30 -0700 (Fri, 23 Sep 2016)
New Revision: 15131

Modified:
   trunk/liblwgeom/ptarray.c
Log:
Simplify loop / make more readable

Modified: trunk/liblwgeom/ptarray.c
===================================================================
--- trunk/liblwgeom/ptarray.c	2016-09-23 06:39:13 UTC (rev 15130)
+++ trunk/liblwgeom/ptarray.c	2016-09-23 17:38:30 UTC (rev 15131)
@@ -986,9 +986,9 @@
 	P1 = getPoint2d_cp(pa, 0);
 	P2 = getPoint2d_cp(pa, 1);
 	x0 = P1->x;
-	for ( i = 1; i < pa->npoints - 1; i++ )
+	for ( i = 2; i < pa->npoints; i++ )
 	{
-		P3 = getPoint2d_cp(pa, i+1);
+		P3 = getPoint2d_cp(pa, i);
 		x = P2->x - x0;
 		y1 = P3->y;
 		y2 = P1->y;



More information about the postgis-tickets mailing list