[GRASS-SVN] r51132 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 21 17:12:19 EDT 2012


Author: martinl
Date: 2012-03-21 14:12:19 -0700 (Wed, 21 Mar 2012)
New Revision: 51132

Modified:
   grass/trunk/lib/gis/find_file.c
   grass/trunk/lib/gis/parser.c
Log:
libgis: cosmetics when checking for existing elements


Modified: grass/trunk/lib/gis/find_file.c
===================================================================
--- grass/trunk/lib/gis/find_file.c	2012-03-21 16:23:12 UTC (rev 51131)
+++ grass/trunk/lib/gis/find_file.c	2012-03-21 21:12:19 UTC (rev 51132)
@@ -18,10 +18,9 @@
 #include <grass/gis.h>
 #include <grass/glocale.h>
 
-static const char *find_file(
-    int misc,
-    const char *dir,
-    const char *element, const char *name, const char *mapset)
+static const char *find_file(int misc, const char *dir,
+			     const char *element, const char *name,
+			     const char *mapset)
 {
     char path[GPATH_MAX];
     char xname[GNAME_MAX], xmapset[GMAPSET_MAX];

Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c	2012-03-21 16:23:12 UTC (rev 51131)
+++ grass/trunk/lib/gis/parser.c	2012-03-21 21:12:19 UTC (rev 51132)
@@ -1313,16 +1313,14 @@
 		int i;
 		char found;
 		
-		found = FALSE;
 		for (i = 0; opt->answers[i]; i++) {
-		    if (strcmp(element, "file") == 0) {
-			if (access(opt->answers[i], F_OK) == 0) {
-			    found = TRUE;
-			}
+		    found = FALSE;
+		    if (strcmp(element, "file") == 0 &&
+			access(opt->answers[i], F_OK) == 0) {
+			found = TRUE;
 		    }
-		    else {
-			if(G_find_file(element, opt->answers[i], G_mapset()))
-			    found = TRUE;
+		    if (G_find_file(element, opt->answers[i], G_mapset())) {
+			found = TRUE;
 		    }
 		    
 		    if (found && strcmp(element, "vector") == 0 &&



More information about the grass-commit mailing list