[GRASS-SVN] r46660 - grass/branches/releasebranch_6_4/lib/vector/diglib

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jun 10 12:21:24 EDT 2011


Author: mmetz
Date: 2011-06-10 09:21:24 -0700 (Fri, 10 Jun 2011)
New Revision: 46660

Modified:
   grass/branches/releasebranch_6_4/lib/vector/diglib/plus_area.c
Log:
sync to 6.5: avoid loop when not debugging

Modified: grass/branches/releasebranch_6_4/lib/vector/diglib/plus_area.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/diglib/plus_area.c	2011-06-10 15:07:23 UTC (rev 46659)
+++ grass/branches/releasebranch_6_4/lib/vector/diglib/plus_area.c	2011-06-10 16:21:24 UTC (rev 46660)
@@ -57,7 +57,16 @@
     int n_lines;
     P_LINE *Line;
     int node;
+    const char *dstr;
+    int debug_level;
 
+    dstr = G__getenv("DEBUG");
+
+    if (dstr != NULL)
+	debug_level = atoi(dstr);
+    else
+	debug_level = 0;
+	
     G_debug(3, "dig_build_area_with_line(): first_line = %d, side = %d",
 	    first_line, side);
 
@@ -106,8 +115,11 @@
 	    /* GOT ONE!  fill area struct  and return */
 	    G_debug(3, "Got one! :");
 
-	    for (i = 0; i < n_lines; i++) {
-		G_debug(3, " area line (%d) = %d", i, array[i]);
+	    /* avoid loop when not debugging */
+	    if (debug_level > 2) {
+		for (i = 0; i < n_lines; i++) {
+		    G_debug(3, " area line (%d) = %d", i, array[i]);
+		}
 	    }
 
 	    *lines = array;
@@ -468,7 +480,16 @@
     plus_t node;
     P_NODE *Node;
     P_LINE *Line;
+    const char *dstr;
+    int debug_level;
 
+    dstr = G__getenv("DEBUG");
+
+    if (dstr != NULL)
+	debug_level = atoi(dstr);
+    else
+	debug_level = 0;
+
     G_debug(3, "dig__angle_next_line: line = %d, side = %d, type = %d",
 	    current_line, side, type);
 
@@ -482,9 +503,12 @@
 
     Node = plus->Node[node];
     G_debug(3, "  n_lines = %d", Node->n_lines);
-    for (i = 0; i < Node->n_lines; i++) {
-	G_debug(3, "  i = %d line = %d angle = %f", i, Node->lines[i],
-		Node->angles[i]);
+    /* avoid loop when not debugging */
+    if (debug_level > 2) {
+	for (i = 0; i < Node->n_lines; i++) {
+	    G_debug(3, "  i = %d line = %d angle = %f", i, Node->lines[i],
+		    Node->angles[i]);
+	}
     }
 
     /* first find index for that line */



More information about the grass-commit mailing list