0001-geo-debug-v00.patch

application/octet-stream

Filename: 0001-geo-debug-v00.patch
Type: application/octet-stream
Part: 0
Message: Re: [PATCH] Improve geometric types

Patch

Format: format-patch
Series: patch v0-0001
Subject: geo-debug-v00
File+
src/backend/utils/adt/geo_ops.c 0 27
From b914483dcd7e71331842c9a83032b2ceea95522b Mon Sep 17 00:00:00 2001
From: Emre Hasegeli <emre@hasegeli.com>
Date: Wed, 1 Aug 2018 12:53:52 +0200
Subject: [PATCH 1/4] geo-debug-v00

Remove GEODEBUG
---
 src/backend/utils/adt/geo_ops.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index 4490f933ba..bd8e21775d 100644
--- a/src/backend/utils/adt/geo_ops.c
+++ b/src/backend/utils/adt/geo_ops.c
@@ -2416,48 +2416,37 @@ dist_polyp(PG_FUNCTION_ARGS)
 
 static double
 dist_ppoly_internal(Point *pt, POLYGON *poly)
 {
 	float8		result;
 	float8		d;
 	int			i;
 	LSEG		seg;
 
 	if (point_inside(pt, poly->npts, poly->p) != 0)
-	{
-#ifdef GEODEBUG
-		printf("dist_ppoly_internal- point inside of polygon\n");
-#endif
 		return 0.0;
-	}
 
 	/* initialize distance with segment between first and last points */
 	seg.p[0].x = poly->p[0].x;
 	seg.p[0].y = poly->p[0].y;
 	seg.p[1].x = poly->p[poly->npts - 1].x;
 	seg.p[1].y = poly->p[poly->npts - 1].y;
 	result = lseg_closept_point(NULL, &seg, pt);
-#ifdef GEODEBUG
-	printf("dist_ppoly_internal- segment 0/n distance is %f\n", result);
-#endif
 
 	/* check distances for other segments */
 	for (i = 0; i < poly->npts - 1; i++)
 	{
 		seg.p[0].x = poly->p[i].x;
 		seg.p[0].y = poly->p[i].y;
 		seg.p[1].x = poly->p[i + 1].x;
 		seg.p[1].y = poly->p[i + 1].y;
 		d = lseg_closept_point(NULL, &seg, pt);
-#ifdef GEODEBUG
-		printf("dist_ppoly_internal- segment %d distance is %f\n", (i + 1), d);
-#endif
 		if (d < result)
 			result = d;
 	}
 
 	return result;
 }
 
 
 /*---------------------------------------------------------------------
  *		interpt_
@@ -5226,49 +5215,33 @@ plist_same(int npts, Point *p1, Point *p2)
 	{
 		if (point_eq_point(&p2[i], &p1[0]))
 		{
 
 			/* match found? then look forward through remaining points */
 			for (ii = 1, j = i + 1; ii < npts; ii++, j++)
 			{
 				if (j >= npts)
 					j = 0;
 				if (!point_eq_point(&p2[j], &p1[ii]))
-				{
-#ifdef GEODEBUG
-					printf("plist_same- %d failed forward match with %d\n", j, ii);
-#endif
 					break;
-				}
 			}
-#ifdef GEODEBUG
-			printf("plist_same- ii = %d/%d after forward match\n", ii, npts);
-#endif
 			if (ii == npts)
 				return true;
 
 			/* match not found forwards? then look backwards */
 			for (ii = 1, j = i - 1; ii < npts; ii++, j--)
 			{
 				if (j < 0)
 					j = (npts - 1);
 				if (!point_eq_point(&p2[j], &p1[ii]))
-				{
-#ifdef GEODEBUG
-					printf("plist_same- %d failed reverse match with %d\n", j, ii);
-#endif
 					break;
-				}
 			}
-#ifdef GEODEBUG
-			printf("plist_same- ii = %d/%d after reverse match\n", ii, npts);
-#endif
 			if (ii == npts)
 				return true;
 		}
 	}
 
 	return false;
 }
 
 
 /*-------------------------------------------------------------------------
-- 
2.14.3 (Apple Git-98)