]> granicus.if.org Git - postgis/commitdiff
Move datum declaration closer to use
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 8 Mar 2019 16:35:05 +0000 (16:35 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 8 Mar 2019 16:35:05 +0000 (16:35 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@17303 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geography_measurement.c

index 59f8a9376fded92f65a1cd4edf8e29f12b76996f..818b3af2ba5b6eae3407b02ccb71e8081f1701bd 100644 (file)
@@ -841,12 +841,7 @@ Datum geography_bestsrid(PG_FUNCTION_ARGS)
        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);
@@ -863,6 +858,7 @@ Datum geography_bestsrid(PG_FUNCTION_ARGS)
        /* 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);