From: Raúl Marín Rodríguez Date: Mon, 30 Jul 2018 16:26:39 +0000 (+0000) Subject: Use user-provided CFLAGS in the topology module X-Git-Tag: 2.5.0beta2~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab2723321520a008193302dc2e4df080c7edb230;p=postgis Use user-provided CFLAGS in the topology module References #4140 git-svn-id: http://svn.osgeo.org/postgis/trunk@16673 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index aac9ee169..27eced998 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ New since PostGIS 2.5.0beta1 (Vinícius A.B. Schmidt, Darafei Praliaskouski) - #4109, Fix WKT parser accepting and interpreting numbers numbers with multiple dots (Raúl Marín, Paul Ramsey) + - #4140, Use user-provided CFLAGS in the topology module (Raúl Marín) See PostGIS 2.5.0 section for full details diff --git a/liblwgeom/liblwgeom_topo.h b/liblwgeom/liblwgeom_topo.h index 390cb5b39..b7affc768 100644 --- a/liblwgeom/liblwgeom_topo.h +++ b/liblwgeom/liblwgeom_topo.h @@ -188,6 +188,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param ids an array of element identifiers * @param numelems input/output parameter, pass number of node identifiers * in the input array, gets number of node in output array. + * TODO: Should be uint64 to match SPI_processed * @param fields fields to be filled in the returned structure, see * LWT_COL_NODE_* macros * @@ -212,6 +213,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param numelems output parameter, gets number of elements found * if the return is not null, otherwise see @return * section for semantic. + * TODO: Should be uint64 to match SPI_processed * @param fields fields to be filled in the returned structure, see * LWT_COL_NODE_* macros * @param limit max number of nodes to return, 0 for no limit, -1 @@ -239,6 +241,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param nodes the nodes to insert. Those with a node_id set to -1 * it will be replaced to an automatically assigned identifier * @param nelems number of elements in the nodes array + * TODO: Should be uint64 to match SPI_processed * * @return 1 on success, 0 on error (@see lastErrorMessage) */ @@ -319,6 +322,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param edges the edges to insert. Those with a edge_id set to -1 * it will be replaced to an automatically assigned identifier * @param nelems number of elements in the edges array + * TODO: Should be uint64 to match SPI_processed * * @return number of inserted edges, or -1 (@see lastErrorMessage) */ @@ -555,6 +559,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param faces the faces to insert. Those with a node_id set to -1 * it will be replaced to an automatically assigned identifier * @param nelems number of elements in the faces array + * TODO: Should be uint64 to match SPI_processed * * @return number of inserted faces, or -1 (@see lastErrorMessage) */ @@ -571,6 +576,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param faces an array of LWT_ISO_FACE object with selecting id * and setting mbr. * @param numfaces number of faces in the "faces" array + * TODO: Should be uint64 to match SPI_processed * * @return number of faces being updated or -1 on error * (@see lastErroMessage) @@ -598,6 +604,7 @@ typedef struct LWT_BE_CALLBACKS_T { * side (left if positive, right if negative) * and direction (forward if positive, backward if negative). * @param numedges output parameter, gets the number of edges visited + * * @param limit max edges to return (to avoid an infinite loop in case * of a corrupted topology). 0 is for unlimited. * The function is expected to error out if the limit is hit. @@ -618,6 +625,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param edges an array of LWT_ISO_EDGE object with selecting id * and updating fields. * @param numedges number of edges in the "edges" array + * TODO: Should be uint64 to match SPI_processed * @param upd_fields fields to be updated for the selected edges, * see LWT_COL_EDGE_* macros * @@ -641,6 +649,7 @@ typedef struct LWT_BE_CALLBACKS_T { * in the input array, gets number of edges in output array * if the return is not null, otherwise see @return * section for semantic. + * TODO: Should be uint64 to match SPI_processed * @param fields fields to be filled in the returned structure, see * LWT_COL_EDGE_* macros * @param box optional bounding box to further restrict matches, use @@ -665,6 +674,7 @@ typedef struct LWT_BE_CALLBACKS_T { * identifiers in the input array, gets number of * nodes in output array if the return is not null, * otherwise see @return section for semantic. + * TODO: Should be uint64 to match SPI_processed * @param fields fields to be filled in the returned structure, see * LWT_COL_NODE_* macros * @param box optional bounding box to further restrict matches, use @@ -687,6 +697,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param nodes an array of LWT_ISO_EDGE objects with selecting id * and updating fields. * @param numnodes number of nodes in the "nodes" array + * TODO: Should be uint64 to match SPI_processed * @param upd_fields fields to be updated for the selected edges, * see LWT_COL_NODE_* macros * @@ -705,6 +716,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param topo the topology to act upon * @param ids an array of face identifiers * @param numelems number of face identifiers in the ids array + * TODO: Should be uint64 to match SPI_processed * * @return number of faces being deleted or -1 on error * (@see lastErrorMessage) @@ -744,6 +756,7 @@ typedef struct LWT_BE_CALLBACKS_T { * @param topo the topology to act upon * @param ids an array of node identifiers * @param numelems number of node identifiers in the ids array + * TODO: Should be uint64 to match SPI_processed * * @return number of nodes being deleted or -1 on error * (@see lastErrorMessage) @@ -847,10 +860,11 @@ typedef struct LWT_BE_CALLBACKS_T { * @param numelems output parameter, gets number of elements found * if the return is not null, otherwise see @return * section for semantic. + * TODO: Should be uint64 to match SPI_processed * @param fields fields to be filled in the returned structure, see * LWT_COL_FACE_* macros * @param limit max number of faces to return, 0 for no limit, -1 - * to only check for existance if a matching row. + * to only check for existence if a matching row. * * @return an array of faces or null in the following cases: * - limit=-1 ("numelems" is set to 1 if found, 0 otherwise) diff --git a/topology/Makefile.in b/topology/Makefile.in index 7a8ac71a0..4f89fbaef 100644 --- a/topology/Makefile.in +++ b/topology/Makefile.in @@ -44,7 +44,7 @@ OBJS = postgis_topology.o # to an existing liblwgeom.so in the PostgreSQL $libdir supplied by an # older version of PostGIS, rather than with the static liblwgeom.a # supplied with newer versions of PostGIS -PG_CPPFLAGS += -I../liblwgeom -I../libpgcommon @CPPFLAGS@ -fPIC +PG_CPPFLAGS += -I../liblwgeom @CFLAGS@ -I../libpgcommon @CPPFLAGS@ -fPIC SHLIB_LINK_F = ../libpgcommon/libpgcommon.a ../liblwgeom/.libs/liblwgeom.a @SHLIB_LINK@ # Add SFCGAL Flags if defined diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c index c39bac16c..adb0c51be 100644 --- a/topology/postgis_topology.c +++ b/topology/postgis_topology.c @@ -962,8 +962,8 @@ cb_getEdgeById(const LWT_BE_TOPOLOGY* topo, return NULL; } - edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed ); - for ( i=0; ivals[i]; fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields); @@ -1025,8 +1025,8 @@ cb_getEdgeByNode(const LWT_BE_TOPOLOGY* topo, return NULL; } - edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed ); - for ( i=0; ivals[i]; fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields); @@ -1106,8 +1106,8 @@ cb_getEdgeByFace(const LWT_BE_TOPOLOGY* topo, return NULL; } - edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed ); - for ( i=0; ivals[i]; fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields); @@ -1162,8 +1162,8 @@ cb_getFacesById(const LWT_BE_TOPOLOGY* topo, return NULL; } - faces = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed ); - for ( i=0; ivals[i]; fillFaceFields(&faces[i], row, SPI_tuptable->tupdesc, fields); @@ -1223,16 +1223,16 @@ cb_getRingEdges(const LWT_BE_TOPOLOGY* topo, { return NULL; } - if ( limit && SPI_processed == limit ) + if ( limit && *numelems == limit ) { cberror(topo->be_data, "Max traversing limit hit: %d", limit-1); *numelems = -1; return NULL; } - edges = palloc( sizeof(LWT_ELEMID) * SPI_processed ); + edges = palloc( sizeof(LWT_ELEMID) * *numelems ); rowdesc = SPI_tuptable->tupdesc; - for ( i=0; ivals[i]; bool isnull; @@ -1299,8 +1299,8 @@ cb_getNodeById(const LWT_BE_TOPOLOGY* topo, return NULL; } - nodes = palloc( sizeof(LWT_ISO_NODE) * SPI_processed ); - for ( i=0; ivals[i]; fillNodeFields(&nodes[i], row, SPI_tuptable->tupdesc, fields); @@ -1361,8 +1361,8 @@ cb_getNodeByFace(const LWT_BE_TOPOLOGY* topo, return NULL; } - nodes = palloc( sizeof(LWT_ISO_NODE) * SPI_processed ); - for ( i=0; ivals[i]; fillNodeFields(&nodes[i], row, SPI_tuptable->tupdesc, fields); @@ -1456,8 +1456,8 @@ cb_getEdgeWithinDistance2D(const LWT_BE_TOPOLOGY* topo, return NULL; } - edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed ); - for ( i=0; ivals[i]; fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields); @@ -1559,13 +1559,13 @@ cb_getNodeWithinDistance2D(const LWT_BE_TOPOLOGY* topo, } else { - nodes = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed ); - for ( i=0; ivals[i]; fillNodeFields(&nodes[i], row, SPI_tuptable->tupdesc, fields); } - *numelems = SPI_processed; SPI_freetuptable(SPI_tuptable); @@ -1610,7 +1610,8 @@ cb_insertNodes( const LWT_BE_TOPOLOGY* topo, if ( SPI_processed ) topo->be_data->data_changed = true; - if ( SPI_processed != numelems ) + // TODO: Remove cast when numelems uses uint64 instead of int + if ( SPI_processed != (uint64) numelems ) { cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected %d", (uint64)SPI_processed, numelems); @@ -1619,7 +1620,7 @@ cb_insertNodes( const LWT_BE_TOPOLOGY* topo, /* Set node_id (could skip this if none had it set to -1) */ /* TODO: check for -1 values in the first loop */ - for ( i=0; ivals[i], @@ -1669,7 +1670,7 @@ cb_insertEdges( const LWT_BE_TOPOLOGY* topo, pfree(sqldata.data); if ( SPI_processed ) topo->be_data->data_changed = true; POSTGIS_DEBUGF(1, "cb_insertEdges query processed %d rows", SPI_processed); - if ( SPI_processed != numelems ) + if ( SPI_processed != (uint64) numelems ) { cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected %d", (uint64)SPI_processed, numelems); @@ -1679,7 +1680,7 @@ cb_insertEdges( const LWT_BE_TOPOLOGY* topo, if ( needsEdgeIdReturn ) { /* Set node_id for items that need it */ - for ( i=0; ivals[i], @@ -1729,7 +1730,7 @@ cb_insertFaces( const LWT_BE_TOPOLOGY* topo, pfree(sqldata.data); if ( SPI_processed ) topo->be_data->data_changed = true; POSTGIS_DEBUGF(1, "cb_insertFaces query processed %d rows", SPI_processed); - if ( SPI_processed != numelems ) + if ( SPI_processed != (uint64) numelems ) { cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected %d", (uint64)SPI_processed, numelems); @@ -1739,7 +1740,7 @@ cb_insertFaces( const LWT_BE_TOPOLOGY* topo, if ( needsFaceIdReturn ) { /* Set node_id for items that need it */ - for ( i=0; ivals[i], @@ -2966,8 +2967,8 @@ cb_getNodeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box, return NULL; } - nodes = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed ); - for ( i=0; ivals[i]; fillNodeFields(&nodes[i], row, SPI_tuptable->tupdesc, fields); @@ -3055,8 +3056,8 @@ cb_getEdgeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box, return NULL; } - edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed ); - for ( i=0; ivals[i]; fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields); @@ -3141,8 +3142,8 @@ cb_getFaceWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box, return NULL; } - faces = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed ); - for ( i=0; ivals[i]; fillFaceFields(&faces[i], row, SPI_tuptable->tupdesc, fields);