[postgis-tickets] r17618 - Topology: Remove TODOs
Raul
raul at rmr.ninja
Fri Jul 19 07:49:17 PDT 2019
Author: algunenano
Date: 2019-07-19 07:49:17 -0700 (Fri, 19 Jul 2019)
New Revision: 17618
Modified:
trunk/liblwgeom/liblwgeom_topo.h
trunk/liblwgeom/lwgeom_topo.c
trunk/topology/postgis_topology.c
Log:
Topology: Remove TODOs
Modified: trunk/liblwgeom/liblwgeom_topo.h
===================================================================
--- trunk/liblwgeom/liblwgeom_topo.h 2019-07-19 14:21:01 UTC (rev 17617)
+++ trunk/liblwgeom/liblwgeom_topo.h 2019-07-19 14:49:17 UTC (rev 17618)
@@ -528,7 +528,6 @@
* @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_t to match SPI_processed
*
* @return number of inserted faces, or -1 (@see lastErrorMessage)
*/
@@ -541,14 +540,13 @@
* @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_t to match SPI_processed
*
- * @return number of faces being updated or -1 on error
+ * @return number of faces being updated or UINT64_MAX on error
* (@see lastErroMessage)
*/
- int (*updateFacesById) (
+ uint64_t (*updateFacesById) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ISO_FACE* faces, int numfaces
+ const LWT_ISO_FACE* faces, uint64_t numfaces
);
/*
@@ -587,7 +585,6 @@
* @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_t to match SPI_processed
* @param upd_fields fields to be updated for the selected edges,
* see LWT_COL_EDGE_* macros
*
@@ -631,7 +628,6 @@
* 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_t 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
Modified: trunk/liblwgeom/lwgeom_topo.c
===================================================================
--- trunk/liblwgeom/lwgeom_topo.c 2019-07-19 14:21:01 UTC (rev 17617)
+++ trunk/liblwgeom/lwgeom_topo.c 2019-07-19 14:49:17 UTC (rev 17618)
@@ -287,9 +287,9 @@
exc_node, exc_fields);
}
-static int
+static uint64_t
lwt_be_updateFacesById(LWT_TOPOLOGY* topo,
- const LWT_ISO_FACE* faces, int numfaces
+ const LWT_ISO_FACE* faces, uint64_t numfaces
)
{
CBT2(topo, updateFacesById, faces, numfaces);
@@ -3438,8 +3438,8 @@
const GBOX* oldbox = lwgeom_get_bbox(lwline_as_lwgeom(oldedge->geom));
const GBOX* newbox = lwgeom_get_bbox(lwline_as_lwgeom(geom));
if ( ! gbox_same(oldbox, newbox) )
- {{
- int facestoupdate = 0;
+ {
+ uint64_t facestoupdate = 0;
LWT_ISO_FACE faces[2];
LWGEOM *nface1 = NULL;
LWGEOM *nface2 = NULL;
@@ -3493,8 +3493,8 @@
LWDEBUGF(1, "%d faces to update", facestoupdate);
if ( facestoupdate )
{
- res = lwt_be_updateFacesById(topo, &(faces[0]), facestoupdate);
- if (res != facestoupdate)
+ uint64_t updatedFaces = lwt_be_updateFacesById(topo, &(faces[0]), facestoupdate);
+ if (updatedFaces != facestoupdate)
{
if (nface1)
lwgeom_free(nface1);
@@ -3501,7 +3501,7 @@
if (nface2)
lwgeom_free(nface2);
_lwt_release_edges(oldedge, 1);
- if (res == -1)
+ if (updatedFaces == UINT64_MAX)
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
else
lwerror("Unexpected error: %d faces found when expecting 1", i);
@@ -3510,9 +3510,11 @@
}
if ( nface1 ) lwgeom_free(nface1);
if ( nface2 ) lwgeom_free(nface2);
- }} else {{
+ }
+ else
+ {
lwnotice("BBOX of changed edge did not change");
- }}
+ }
LWDEBUG(1, "all done, cleaning up edges");
Modified: trunk/topology/postgis_topology.c
===================================================================
--- trunk/topology/postgis_topology.c 2019-07-19 14:21:01 UTC (rev 17617)
+++ trunk/topology/postgis_topology.c 2019-07-19 14:49:17 UTC (rev 17618)
@@ -1918,12 +1918,12 @@
return SPI_processed;
}
-static int
+static uint64_t
cb_updateFacesById( const LWT_BE_TOPOLOGY* topo,
- const LWT_ISO_FACE* faces, int numfaces )
+ const LWT_ISO_FACE* faces, uint64_t numfaces )
{
MemoryContext oldcontext = CurrentMemoryContext;
- int i;
+ uint64_t i;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
@@ -1955,7 +1955,7 @@
cberror(topo->be_data, "unexpected return (%d) from query execution: %s",
spi_result, sql->data);
pfree(sqldata.data);
- return -1;
+ return UINT64_MAX;
}
pfree(sqldata.data);
More information about the postgis-tickets
mailing list