[GRASS-SVN] r44854 - grass/trunk/lib/vector/diglib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 4 04:59:59 EST 2011


Author: mmetz
Date: 2011-01-04 01:59:59 -0800 (Tue, 04 Jan 2011)
New Revision: 44854

Modified:
   grass/trunk/lib/vector/diglib/plus_area.c
Log:
small optimization

Modified: grass/trunk/lib/vector/diglib/plus_area.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_area.c	2011-01-04 09:23:48 UTC (rev 44853)
+++ grass/trunk/lib/vector/diglib/plus_area.c	2011-01-04 09:59:59 UTC (rev 44854)
@@ -19,6 +19,8 @@
 #include <grass/vector.h>
 #include <grass/glocale.h>
 
+static int debug_level = -1;
+
 /*!
  * \brief Build topo for area from lines
  *
@@ -58,16 +60,16 @@
     int n_lines;
     struct P_line *Line;
     int node;
-    const char *dstr;
-    int debug_level;
 
-    dstr = G__getenv("DEBUG");
+    if (debug_level == -1) {
+	const char *dstr = G__getenv("DEBUG");
 
-    if (dstr != NULL)
-	debug_level = atoi(dstr);
-    else
-	debug_level = 0;
-	
+	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);
 
@@ -482,15 +484,15 @@
     plus_t node;
     struct P_node *Node;
     struct P_line *Line;
-    const char *dstr;
-    int debug_level;
 
-    dstr = G__getenv("DEBUG");
+    if (debug_level == -1) {
+	const char *dstr = G__getenv("DEBUG");
 
-    if (dstr != NULL)
-	debug_level = atoi(dstr);
-    else
-	debug_level = 0;
+	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);



More information about the grass-commit mailing list