[GRASS-SVN] r72734 - grass/trunk/raster/r.path

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 23 13:27:07 PDT 2018


Author: mmetz
Date: 2018-05-23 13:27:07 -0700 (Wed, 23 May 2018)
New Revision: 72734

Modified:
   grass/trunk/raster/r.path/main.c
Log:
r.path: avoid infinite loop for invalid start point, add verbose messages

Modified: grass/trunk/raster/r.path/main.c
===================================================================
--- grass/trunk/raster/r.path/main.c	2018-05-23 07:17:20 UTC (rev 72733)
+++ grass/trunk/raster/r.path/main.c	2018-05-23 20:27:07 UTC (rev 72734)
@@ -290,7 +290,7 @@
 	    if (1 > Vect_open_old(&In, vpointopt->answers[i], ""))
 		G_fatal_error(_("Unable to open vector map <%s>"), vpointopt->answers[i]);
 
-	    G_message(_("Reading vector map <%s> with start points..."),
+	    G_verbose_message(_("Reading vector map <%s> with start points..."),
                       Vect_get_full_name(&In));
             
 	    Vect_rewind(&In);
@@ -356,6 +356,8 @@
     if (opt2->answer && opt3->answer) {
 	DCELL *map_buf;
 
+	G_verbose_message(_("Reading raster values map <%s> ..."), map_name);
+
 	tempfile1 = G_tempfile();
 	val_fd = open(tempfile1, O_RDWR | O_CREAT, 0666);
 
@@ -419,6 +421,7 @@
     if (dir_format <= 0)
 	G_fatal_error(_("Invalid directions format '%s'"), dfopt->answer);
 
+    G_verbose_message(_("Reading direction map <%s> ..."), dir_name);
     dir_id = Rast_open_old(dir_name, "");
     tempfile2 = G_tempfile();
     dir_fd = open(tempfile2, O_RDWR | O_CREAT, 0666);
@@ -465,7 +468,7 @@
     /* determine the drainage paths */
 
     /* repeat for each starting point */
-
+    G_verbose_message(_("Processing start points..."));
     next_start_pt = head_start_pt;
     while (next_start_pt) {
 	/* follow directions from start points to determine paths */
@@ -613,6 +616,8 @@
 	unlink(tempfile1);
     }
 
+    G_done_msg(" ");
+
     exit(EXIT_SUCCESS);
 }
 
@@ -766,6 +771,11 @@
 		}
 
 		/* leave this loop */
+		if (is_stack) {
+		    newp = stackp->next;
+		    G_free(stackp);
+		    stackp = newp;
+		}
 		break;
 	    }
 



More information about the grass-commit mailing list