[postgis-tickets] r17491 - Remove gserialized_get_zm() since it's barely used
Paul Ramsey
pramsey at cleverelephant.ca
Tue Jun 11 08:42:04 PDT 2019
Author: pramsey
Date: 2019-06-11 08:42:03 -0700 (Tue, 11 Jun 2019)
New Revision: 17491
Modified:
trunk/liblwgeom/g_serialized.c
trunk/liblwgeom/liblwgeom.h.in
trunk/postgis/lwgeom_functions_basic.c
trunk/raster/rt_pg/rtpg_mapalgebra.c
Log:
Remove gserialized_get_zm() since it's barely used
Modified: trunk/liblwgeom/g_serialized.c
===================================================================
--- trunk/liblwgeom/g_serialized.c 2019-06-11 15:06:12 UTC (rev 17490)
+++ trunk/liblwgeom/g_serialized.c 2019-06-11 15:42:03 UTC (rev 17491)
@@ -52,11 +52,6 @@
return FLAGS_GET_M(gser->flags);
}
-int gserialized_get_zm(const GSERIALIZED *gser)
-{
- return 2 * FLAGS_GET_Z(gser->flags) + FLAGS_GET_M(gser->flags);
-}
-
int gserialized_ndims(const GSERIALIZED *gser)
{
return FLAGS_NDIMS(gser->flags);
Modified: trunk/liblwgeom/liblwgeom.h.in
===================================================================
--- trunk/liblwgeom/liblwgeom.h.in 2019-06-11 15:06:12 UTC (rev 17490)
+++ trunk/liblwgeom/liblwgeom.h.in 2019-06-11 15:42:03 UTC (rev 17491)
@@ -730,12 +730,6 @@
extern int gserialized_is_geodetic(const GSERIALIZED *gser);
/**
-* Return a number indicating presence of Z and M coordinates.
-* 0 = None, 1 = M, 2 = Z, 3 = ZM
-*/
-extern int gserialized_get_zm(const GSERIALIZED *gser);
-
-/**
* Return the number of dimensions (2, 3, 4) in a geometry
*/
extern int gserialized_ndims(const GSERIALIZED *gser);
Modified: trunk/postgis/lwgeom_functions_basic.c
===================================================================
--- trunk/postgis/lwgeom_functions_basic.c 2019-06-11 15:06:12 UTC (rev 17490)
+++ trunk/postgis/lwgeom_functions_basic.c 2019-06-11 15:42:03 UTC (rev 17491)
@@ -1903,22 +1903,11 @@
PG_FUNCTION_INFO_V1(LWGEOM_noop);
Datum LWGEOM_noop(PG_FUNCTION_ARGS)
{
- GSERIALIZED *in, *out;
- LWGEOM *lwgeom;
-
- POSTGIS_DEBUG(2, "LWGEOM_noop called");
-
- in = PG_GETARG_GSERIALIZED_P(0);
-
- lwgeom = lwgeom_from_gserialized(in);
-
- POSTGIS_DEBUGF(3, "Deserialized: %s", lwgeom_summary(lwgeom, 0));
-
- out = geometry_serialize(lwgeom);
-
+ GSERIALIZED *in = PG_GETARG_GSERIALIZED_P(0);
+ LWGEOM *lwgeom = lwgeom_from_gserialized(in);
+ GSERIALIZED *out = geometry_serialize(lwgeom);;
lwgeom_free(lwgeom);
PG_FREE_IF_COPY(in, 0);
-
PG_RETURN_POINTER(out);
}
@@ -1958,10 +1947,9 @@
PG_FUNCTION_INFO_V1(LWGEOM_zmflag);
Datum LWGEOM_zmflag(PG_FUNCTION_ARGS)
{
- GSERIALIZED *in;
+ GSERIALIZED *in = PG_GETARG_GSERIALIZED_P(0);;
int ret = 0;
- in = PG_GETARG_GSERIALIZED_P(0);
if (gserialized_has_z(in))
ret += 2;
if (gserialized_has_m(in))
@@ -1997,11 +1985,8 @@
PG_FUNCTION_INFO_V1(LWGEOM_ndims);
Datum LWGEOM_ndims(PG_FUNCTION_ARGS)
{
- GSERIALIZED *in;
- int ret;
-
- in = PG_GETARG_GSERIALIZED_P(0);
- ret = (gserialized_ndims(in));
+ GSERIALIZED *in = PG_GETARG_GSERIALIZED_P(0);
+ int ret = gserialized_ndims(in);
PG_FREE_IF_COPY(in, 0);
PG_RETURN_INT16(ret);
}
@@ -2015,20 +2000,15 @@
LWGEOM *lwg1, *lwg2;
bool result;
- if (gserialized_get_type(g1) != gserialized_get_type(g2))
+ if ((gserialized_get_type(g1) != gserialized_get_type(g2)) ||
+ (gserialized_has_z(g1) != gserialized_has_z(g2)) ||
+ (gserialized_has_m(g1) != gserialized_has_m(g2)))
{
PG_FREE_IF_COPY(g1, 0);
PG_FREE_IF_COPY(g2, 1);
- PG_RETURN_BOOL(false); /* different types */
+ PG_RETURN_BOOL(false); /* different type or dimensionality */
}
- if (gserialized_get_zm(g1) != gserialized_get_zm(g2))
- {
- PG_FREE_IF_COPY(g1, 0);
- PG_FREE_IF_COPY(g2, 1);
- PG_RETURN_BOOL(false); /* different dimensions */
- }
-
/* ok, deserialize. */
lwg1 = lwgeom_from_gserialized(g1);
lwg2 = lwgeom_from_gserialized(g2);
Modified: trunk/raster/rt_pg/rtpg_mapalgebra.c
===================================================================
--- trunk/raster/rt_pg/rtpg_mapalgebra.c 2019-06-11 15:06:12 UTC (rev 17490)
+++ trunk/raster/rt_pg/rtpg_mapalgebra.c 2019-06-11 15:42:03 UTC (rev 17491)
@@ -77,6 +77,10 @@
/* n-raster MapAlgebra */
/* ---------------------------------------------------------------- */
+/* Quiet warning */
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wgnu-variable-sized-type-not-at-end"
+
typedef struct {
Oid ufc_noid;
Oid ufc_rettype;
@@ -93,6 +97,9 @@
#endif
} rtpg_nmapalgebra_callback_arg;
+#pragma clang diagnostic pop
+/* ! Quiet warning */
+
typedef struct rtpg_nmapalgebra_arg_t *rtpg_nmapalgebra_arg;
struct rtpg_nmapalgebra_arg_t {
int numraster;
More information about the postgis-tickets
mailing list