[GRASS-SVN] r58354 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 2 09:57:32 PST 2013


Author: martinl
Date: 2013-12-02 09:57:31 -0800 (Mon, 02 Dec 2013)
New Revision: 58354

Modified:
   grass/trunk/lib/vector/Vlib/close.c
Log:
vlib: cosmetics when closing spatial index file


Modified: grass/trunk/lib/vector/Vlib/close.c
===================================================================
--- grass/trunk/lib/vector/Vlib/close.c	2013-12-02 17:11:26 UTC (rev 58353)
+++ grass/trunk/lib/vector/Vlib/close.c	2013-12-02 17:57:31 UTC (rev 58354)
@@ -198,17 +198,19 @@
 	else if (Map->format == GV_FORMAT_POSTGIS)
             V2_close_pg(Map);
     }
-    /* spatial index must also be closed when opened with topo but
-     * not modified */
-    /* NOTE: also close sidx for GV_FORMAT_OGR if not direct OGR access */
-    if (Map->format != GV_FORMAT_OGR_DIRECT &&
-	Map->plus.Spidx_built == TRUE &&
+
+    /* spatial index must also be closed when opened with topo but not
+     * modified */
+    if (Map->plus.spidx_fp.file &&
+        Map->plus.Spidx_built == TRUE &&
 	!Map->support_updated &&
-	Map->plus.built == GV_BUILD_ALL &&
-	create_link) {
+	Map->plus.built == GV_BUILD_ALL) {
 
+        G_debug(1, "spatial index file closed");
 	fclose(Map->plus.spidx_fp.file);
     }
+
+    /* release memory if required */
     if (Map->level > 1 && Map->plus.release_support) {
 	G_debug(1, "free topology, spatial index, and category index");
 	dig_free_plus(&(Map->plus));



More information about the grass-commit mailing list