[postgis-tickets] r16359 - Remove unneeded casts

Daniel Baston dbaston at gmail.com
Tue Jan 23 05:51:53 PST 2018


Author: dbaston
Date: 2018-01-23 17:51:53 -0800 (Tue, 23 Jan 2018)
New Revision: 16359

Modified:
   trunk/postgis/lwgeom_geos.c
Log:
Remove unneeded casts

Modified: trunk/postgis/lwgeom_geos.c
===================================================================
--- trunk/postgis/lwgeom_geos.c	2018-01-22 14:15:29 UTC (rev 16358)
+++ trunk/postgis/lwgeom_geos.c	2018-01-24 01:51:53 UTC (rev 16359)
@@ -187,11 +187,11 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+	g2 = POSTGIS2GEOS(geom2);
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
@@ -239,11 +239,11 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+	g2 = POSTGIS2GEOS(geom2);
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
@@ -299,11 +299,11 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+	g2 = POSTGIS2GEOS(geom2);
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
@@ -459,7 +459,7 @@
 		}
 		else
 		{
-			g = (GEOSGeometry *)POSTGIS2GEOS(gser_in);
+			g = POSTGIS2GEOS(gser_in);
 
 			/* Uh oh! Exception thrown at construction... */
 			if ( ! g )
@@ -666,7 +666,7 @@
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g3 = (GEOSGeometry *)GEOSBoundary(g1);
+	g3 = GEOSBoundary(g1);
 
 	if (!g3)
 	{
@@ -718,12 +718,12 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g3 = (GEOSGeometry *)GEOSConvexHull(g1);
+	g3 = GEOSConvexHull(g1);
 	GEOSGeom_destroy(g1);
 
 	if (!g3) HANDLE_GEOS_ERROR("GEOSConvexHull");
@@ -780,7 +780,7 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
@@ -854,7 +854,7 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
@@ -1257,7 +1257,7 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
+	g1 = POSTGIS2GEOS(geom);
 
 	if (!g1)
 	{
@@ -1335,7 +1335,7 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	geosgeom = (GEOSGeometry *)POSTGIS2GEOS(geom);
+	geosgeom = POSTGIS2GEOS(geom);
 
 	if (!geosgeom)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
@@ -1546,7 +1546,7 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
+	g1 = POSTGIS2GEOS(geom);
 	if ( g1 )
 	{
 		reason_str = GEOSisValidReason(g1);
@@ -1611,7 +1611,7 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
+	g1 = POSTGIS2GEOS(geom);
 
 	if ( g1 )
 	{
@@ -1626,7 +1626,7 @@
 		if ( geos_location )
 		{
 			location = GEOS2LWGEOM(geos_location, GEOSHasZ(geos_location));
-			GEOSGeom_destroy((GEOSGeometry *)geos_location);
+			GEOSGeom_destroy(geos_location);
 		}
 
 		if (valid == 2)
@@ -1700,11 +1700,11 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+	g2 = POSTGIS2GEOS(geom2);
 
 	if (!g2)
 	{
@@ -1830,7 +1830,7 @@
 
 	if ( prep_cache && prep_cache->prepared_geom && prep_cache->argnum == 1 )
 	{
-		g1 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+		g1 = POSTGIS2GEOS(geom2);
 		if (!g1)
 			HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
 
@@ -1840,12 +1840,12 @@
 	}
 	else
 	{
-		g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+		g1 = POSTGIS2GEOS(geom1);
 		if (!g1)
 			HANDLE_GEOS_ERROR(
 			    "First argument geometry could not be converted to "
 			    "GEOS");
-		g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+		g2 = POSTGIS2GEOS(geom2);
 		if (!g2)
 		{
 			HANDLE_GEOS_ERROR(
@@ -1904,7 +1904,7 @@
 
 	if ( prep_cache && prep_cache->prepared_geom && prep_cache->argnum == 1 )
 	{
-		GEOSGeometry *g = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+		GEOSGeometry *g = POSTGIS2GEOS(geom2);
 		if (!g)
 			HANDLE_GEOS_ERROR(
 			    "First argument geometry could not be converted to "
@@ -1917,12 +1917,12 @@
 		GEOSGeometry *g2;
 		GEOSGeometry *g1;
 
-		g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+		g1 = POSTGIS2GEOS(geom1);
 		if (!g1)
 			HANDLE_GEOS_ERROR(
 			    "First argument geometry could not be converted to "
 			    "GEOS");
-		g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+		g2 = POSTGIS2GEOS(geom2);
 		if (!g2)
 		{
 			GEOSGeom_destroy(g1);
@@ -2038,7 +2038,7 @@
 
 	if ( prep_cache && prep_cache->prepared_geom && prep_cache->argnum == 1 )
 	{
-		GEOSGeometry *g1 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+		GEOSGeometry *g1 = POSTGIS2GEOS(geom2);
 		if (!g1)
 			HANDLE_GEOS_ERROR(
 			    "First argument geometry could not be converted to "
@@ -2051,12 +2051,12 @@
 		GEOSGeometry *g1;
 		GEOSGeometry *g2;
 
-		g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+		g1 = POSTGIS2GEOS(geom1);
 		if (!g1)
 			HANDLE_GEOS_ERROR(
 			    "First argument geometry could not be converted to "
 			    "GEOS");
-		g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+		g2 = POSTGIS2GEOS(geom2);
 		if (!g2)
 		{
 			GEOSGeom_destroy(g1);
@@ -2180,12 +2180,12 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+	g2 = POSTGIS2GEOS(geom2);
 
 	if (!g2)
 	{
@@ -2241,11 +2241,11 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+	g2 = POSTGIS2GEOS(geom2);
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
@@ -2355,7 +2355,7 @@
 	{
 		if ( prep_cache->argnum == 1 )
 		{
-			GEOSGeometry *g = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+			GEOSGeometry *g = POSTGIS2GEOS(geom2);
 			if (!g)
 				HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
 			result = GEOSPreparedIntersects( prep_cache->prepared_geom, g);
@@ -2363,7 +2363,7 @@
 		}
 		else
 		{
-			GEOSGeometry *g = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+			GEOSGeometry *g = POSTGIS2GEOS(geom1);
 			if (!g)
 				HANDLE_GEOS_ERROR("Geometry could not be converted to GEOS");
 			result = GEOSPreparedIntersects( prep_cache->prepared_geom, g);
@@ -2374,12 +2374,12 @@
 	{
 		GEOSGeometry *g1;
 		GEOSGeometry *g2;
-		g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+		g1 = POSTGIS2GEOS(geom1);
 		if (!g1)
 			HANDLE_GEOS_ERROR(
 			    "First argument geometry could not be converted to "
 			    "GEOS");
-		g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+		g2 = POSTGIS2GEOS(geom2);
 		if (!g2)
 		{
 			GEOSGeom_destroy(g1);
@@ -2435,11 +2435,11 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1 );
+	g1 = POSTGIS2GEOS(geom1 );
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2 );
+	g2 = POSTGIS2GEOS(geom2 );
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
@@ -2495,11 +2495,11 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+	g2 = POSTGIS2GEOS(geom2);
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
@@ -2541,10 +2541,10 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+	g2 = POSTGIS2GEOS(geom2);
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
@@ -2606,10 +2606,10 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1 );
+	g1 = POSTGIS2GEOS(geom1 );
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2 );
+	g2 = POSTGIS2GEOS(geom2 );
 	if (!g2)
 	{
 		GEOSGeom_destroy(g1);
@@ -2681,12 +2681,12 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom1);
+	g1 = POSTGIS2GEOS(geom1);
 
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
-	g2 = (GEOSGeometry *)POSTGIS2GEOS(geom2);
+	g2 = POSTGIS2GEOS(geom2);
 
 	if (!g2)
 	{
@@ -2749,7 +2749,7 @@
 
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
-	g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
+	g1 = POSTGIS2GEOS(geom);
 	if (!g1)
 		HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
 
@@ -2923,7 +2923,7 @@
 
 		*is3d = *is3d || gserialized_has_z(geom);
 
-		geos_geoms[i] = (GEOSGeometry*) POSTGIS2GEOS(geom);
+		geos_geoms[i] = POSTGIS2GEOS(geom);
 		if (!geos_geoms[i])
 		{
             uint32_t j;
@@ -2968,7 +2968,7 @@
 	initGEOS(lwpgnotice, lwgeom_geos_error);
 
 	geom = PG_GETARG_GSERIALIZED_P(0);
-	geosgeom = (GEOSGeometry *)POSTGIS2GEOS(geom);
+	geosgeom = POSTGIS2GEOS(geom);
 	if ( ! geosgeom ) PG_RETURN_NULL();
 
 	lwgeom_result = GEOS2POSTGIS(geosgeom, gserialized_has_z(geom));
@@ -3092,7 +3092,7 @@
 	pfree(geos_results);
 
 	get_typlenbyvalalign(array->elemtype, &elmlen, &elmbyval, &elmalign);
-	result = (ArrayType*) construct_array(result_array_data, nclusters, array->elemtype, elmlen, elmbyval, elmalign);
+	result = construct_array(result_array_data, nclusters, array->elemtype, elmlen, elmbyval, elmalign);
 
 	if (!result)
 	{
@@ -3168,7 +3168,7 @@
 	pfree(lw_results);
 
 	get_typlenbyvalalign(array->elemtype, &elmlen, &elmbyval, &elmalign);
-	result = (ArrayType*) construct_array(result_array_data, nclusters, array->elemtype, elmlen, elmbyval, elmalign);
+	result =  construct_array(result_array_data, nclusters, array->elemtype, elmlen, elmbyval, elmalign);
 
 	if (!result)
 	{
@@ -3626,3 +3626,4 @@
 	PG_RETURN_POINTER(result);
 #endif
 }
+



More information about the postgis-tickets mailing list