From: Paul Ramsey Date: Wed, 29 Apr 2015 15:55:30 +0000 (+0000) Subject: C90 madness X-Git-Tag: 2.2.0rc1~539 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3dff930290f9f0a802099f1140bd5c25b903f809;p=postgis C90 madness git-svn-id: http://svn.osgeo.org/postgis/trunk@13459 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_export.c b/postgis/lwgeom_export.c index eba0d30da..9232b9392 100644 --- a/postgis/lwgeom_export.c +++ b/postgis/lwgeom_export.c @@ -177,6 +177,10 @@ Datum LWGEOM_asGML(PG_FUNCTION_ARGS) static const char* default_prefix = "gml:"; /* default prefix */ const char* prefix = default_prefix; const char* gml_id = NULL; + size_t len; + char *gml_id_buf, *prefix_buf; + text *prefix_text, *gml_id_text; + /* Get the version */ version = PG_GETARG_INT32(0); @@ -207,15 +211,15 @@ Datum LWGEOM_asGML(PG_FUNCTION_ARGS) /* retrieve prefix */ if (PG_NARGS() >4 && !PG_ARGISNULL(4)) { - text* prefix_text = PG_GETARG_TEXT_P(4); + prefix_text = PG_GETARG_TEXT_P(4); if ( VARSIZE(prefix_text) == VARHDRSZ ) { prefix = ""; } else { - size_t len = VARSIZE(prefix_text)-VARHDRSZ; - char* prefix_buf = palloc(len + 2); /* +2 is one for the ':' and one for term null */ + len = VARSIZE(prefix_text)-VARHDRSZ; + prefix_buf = palloc(len + 2); /* +2 is one for the ':' and one for term null */ memcpy(prefix_buf, VARDATA(prefix_text), len); /* add colon and null terminate */ prefix_buf[len] = ':'; @@ -226,15 +230,15 @@ Datum LWGEOM_asGML(PG_FUNCTION_ARGS) if (PG_NARGS() >5 && !PG_ARGISNULL(5)) { - text* gml_id_text = PG_GETARG_TEXT_P(5); + gml_id_text = PG_GETARG_TEXT_P(5); if ( VARSIZE(gml_id_text) == VARHDRSZ ) { gml_id = ""; } else { - size_t len = VARSIZE(gml_id_text)-VARHDRSZ; - char* gml_id_buf = palloc(len+1); + len = VARSIZE(gml_id_text)-VARHDRSZ; + gml_id_buf = palloc(len+1); memcpy(gml_id_buf, VARDATA(gml_id_text), len); gml_id_buf[len] = '\0'; gml_id = gml_id_buf;