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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 1 09:45:11 PDT 2013


Author: martinl
Date: 2013-08-01 09:45:11 -0700 (Thu, 01 Aug 2013)
New Revision: 57347

Modified:
   grass/trunk/lib/vector/diglib/update.c
Log:
vlib: enable check for duplications in dig_line_add_updated()
      assuming that uplist is not large (list is reseted for every operation)


Modified: grass/trunk/lib/vector/diglib/update.c
===================================================================
--- grass/trunk/lib/vector/diglib/update.c	2013-08-01 16:42:21 UTC (rev 57346)
+++ grass/trunk/lib/vector/diglib/update.c	2013-08-01 16:45:11 UTC (rev 57347)
@@ -36,14 +36,18 @@
  */
 void dig_line_add_updated(struct Plus_head *Plus, int line)
 {
+    int i;
+    
     G_debug(3, "dig_line_add_updated(): line = %d", line);
 
-    /* Check if already in list
-    for (i = 0; i < Plus->uplist.n_uplines; i++)
-	if (Plus->uplist.uplines[i] == line)
+    /* Check if already in list */
+    for (i = 0; i < Plus->uplist.n_uplines; i++) {
+	if (Plus->uplist.uplines[i] == line) {
+            G_debug(3, "\tskipped");
 	    return;
-    */
-
+        }
+    }
+    
     /* Alloc space if needed */
     if (Plus->uplist.n_uplines == Plus->uplist.alloc_uplines) {
 	Plus->uplist.alloc_uplines += 1000;
@@ -82,9 +86,12 @@
     G_debug(3, "dig_node_add_updated(): node = %d", node);
 
     /* Check if already in list */
-    for (i = 0; i < Plus->uplist.n_upnodes; i++)
-	if (Plus->uplist.upnodes[i] == node)
+    for (i = 0; i < Plus->uplist.n_upnodes; i++) {
+	if (abs(Plus->uplist.upnodes[i]) == abs(node)) {
+            G_debug(3, "\tskipped");
 	    return;
+        }
+    }
 
     /* Alloc space if needed */
     if (Plus->uplist.n_upnodes == Plus->uplist.alloc_upnodes) {



More information about the grass-commit mailing list