[postgis-tickets] r17303 - Move datum declaration closer to use

Paul Ramsey pramsey at cleverelephant.ca
Fri Mar 8 08:35:05 PST 2019


Author: pramsey
Date: 2019-03-08 08:35:05 -0800 (Fri, 08 Mar 2019)
New Revision: 17303

Modified:
   trunk/postgis/geography_measurement.c
Log:
Move datum declaration closer to use


Modified: trunk/postgis/geography_measurement.c
===================================================================
--- trunk/postgis/geography_measurement.c	2019-03-08 16:32:35 UTC (rev 17302)
+++ trunk/postgis/geography_measurement.c	2019-03-08 16:35:05 UTC (rev 17303)
@@ -841,13 +841,8 @@
 	int empty2 = LW_FALSE;
 	double xwidth, ywidth;
 	POINT2D center;
-
 	Datum d1 = PG_GETARG_DATUM(0);
-	Datum d2;
 
-	if (PG_NARGS() > 1)
-		d2 = PG_GETARG_DATUM(1);
-
 	/* Get our geometry objects loaded into memory. */
 	g1 = (GSERIALIZED*)PG_DETOAST_DATUM(d1);
 	/* Synchronize our box types */
@@ -863,6 +858,7 @@
 	/* If we have a unique second argument, fill in all the necessary variables. */
 	if (PG_NARGS() > 1)
 	{
+		Datum d2 = PG_GETARG_DATUM(1);
 		g2 = (GSERIALIZED*)PG_DETOAST_DATUM(d2);
 		gbox2.flags = g2->flags;
 		empty2 = gserialized_is_empty(g2);



More information about the postgis-tickets mailing list