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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 28 07:36:48 EST 2009


Author: mmetz
Date: 2009-02-28 07:36:48 -0500 (Sat, 28 Feb 2009)
New Revision: 36138

Modified:
   grass/trunk/lib/vector/Vlib/select.c
Log:
Vlib: small topology building speed up

Modified: grass/trunk/lib/vector/Vlib/select.c
===================================================================
--- grass/trunk/lib/vector/Vlib/select.c	2009-02-28 12:35:57 UTC (rev 36137)
+++ grass/trunk/lib/vector/Vlib/select.c	2009-02-28 12:36:48 UTC (rev 36138)
@@ -93,7 +93,16 @@
 			 struct ilist *list)
 {
     int i;
+    const char *dstr;
+    int debug_level;
 
+    dstr = G__getenv("DEBUG");
+
+    if (dstr != NULL)
+	debug_level = atoi(dstr);
+    else
+	debug_level = 0;
+
     G_debug(3, "Vect_select_areas_by_box()");
     G_debug(3, "Box(N,S,E,W,T,B): %e, %e, %e, %e, %e, %e", Box->N, Box->S,
 	    Box->E, Box->W, Box->T, Box->B);
@@ -105,12 +114,15 @@
 
     dig_select_areas(&(Map->plus), Box, list);
     G_debug(3, "  %d areas selected", list->n_values);
-    for (i = 0; i < list->n_values; i++) {
-	G_debug(3, "  area = %d pointer to area structure = %lx",
-		list->value[i],
-		(unsigned long)Map->plus.Area[list->value[i]]);
-
+    /* avoid loop when not debugging */
+    if (debug_level > 2) {
+	for (i = 0; i < list->n_values; i++) {
+	    G_debug(3, "  area = %d pointer to area structure = %lx",
+		    list->value[i],
+		    (unsigned long)Map->plus.Area[list->value[i]]);
+	}
     }
+    
     return list->n_values;
 }
 



More information about the grass-commit mailing list