[GRASS-SVN] r34123 - grass/branches/develbranch_6/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 31 05:41:00 EDT 2008


Author: marisn
Date: 2008-10-31 05:41:00 -0400 (Fri, 31 Oct 2008)
New Revision: 34123

Modified:
   grass/branches/develbranch_6/lib/vector/Vlib/array.c
Log:
Add some comments about varray initialisation

Modified: grass/branches/develbranch_6/lib/vector/Vlib/array.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/array.c	2008-10-31 08:33:13 UTC (rev 34122)
+++ grass/branches/develbranch_6/lib/vector/Vlib/array.c	2008-10-31 09:41:00 UTC (rev 34123)
@@ -69,6 +69,7 @@
    GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID
 
    Array is not reset to zero before, but old values (if any > 0) are overwritten.
+   Array must be initialised by Vect_new_varray(size) call.
 
    \param Map vector map
    \param field layer number
@@ -115,6 +116,7 @@
    GV_CENTROID
 
    Array is not reset to zero before, but old values (if any > 0) are overwritten.
+   Array must be initialised by Vect_new_varray(size) call.
 
    \param Map vector map
    \param field layer number
@@ -233,7 +235,7 @@
    either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID
 
    Array is not reset to zero before, but old values (if any > 0) are
-   overwritten.
+   overwritten. Array must be initialised by Vect_new_varray(size) call.
 
    \param Map vector map
    \param field layer number
@@ -297,6 +299,9 @@
     if (type & GV_AREA) {	/* Areas */
 	n = Vect_get_num_areas(Map);
 
+        /* IMHO varray should be allocated only when it's required AND only as large as required
+        as WHERE will create a small subset of all vector features and thus on large datasets
+        it's waste of memory to allocate it for all features. */
 	if (n > varray->size) {	/* not enough space */
 	    G_warning(_("Not enough space in vector array"));
 	    return 0;



More information about the grass-commit mailing list