[GRASS-SVN] r64136 - grass/trunk/general/g.rename

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 13 08:54:09 PST 2015


Author: hcho
Date: 2015-01-13 08:54:09 -0800 (Tue, 13 Jan 2015)
New Revision: 64136

Modified:
   grass/trunk/general/g.rename/main.c
Log:
g.rename: variable scoping

Modified: grass/trunk/general/g.rename/main.c
===================================================================
--- grass/trunk/general/g.rename/main.c	2015-01-13 16:50:08 UTC (rev 64135)
+++ grass/trunk/general/g.rename/main.c	2015-01-13 16:54:09 UTC (rev 64136)
@@ -3,13 +3,13 @@
  *
  * MODULE:       g.rename
  * AUTHOR(S):    CERL (original contributor)
- *               Radim Blazek <radim.blazek gmail.com>, 
- *               Cedric Shock <cedricgrass shockfamily.net>, 
- *               Glynn Clements <glynn gclements.plus.com>, 
- *               Markus Neteler <neteler itc.it>, 
+ *               Radim Blazek <radim.blazek gmail.com>,
+ *               Cedric Shock <cedricgrass shockfamily.net>,
+ *               Glynn Clements <glynn gclements.plus.com>,
+ *               Markus Neteler <neteler itc.it>,
  *               Martin Landa <landa.martin gmail.com>,
  *               Huidae Cho <grass4u gmail.com>
- * PURPOSE:      
+ * PURPOSE:      Rename map names
  * COPYRIGHT:    (C) 1994-2007, 2011-2014 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
@@ -30,10 +30,9 @@
 
 int main(int argc, char *argv[])
 {
-    int i, n;
+    int n;
     struct GModule *module;
     struct Option **parm;
-    char *old, *new;
     int nlist;
     const char *mapset;
     int result = EXIT_SUCCESS;
@@ -62,6 +61,9 @@
     mapset = G_mapset();
 
     for (n = 0; n < nlist; n++) {
+	int i;
+	char *old, *new;
+
 	if (parm[n]->answers == NULL)
 	    continue;
 	i = 0;
@@ -105,9 +107,8 @@
 
 void rename_child_reclass_maps(const char *name, const char *mapset)
 {
-    int nrmaps, ptr, l;
-    char **rmaps, buf1[256], buf2[256], buf3[256], *str;
-    FILE *fp;
+    int nrmaps;
+    char **rmaps;
 
     if (Rast_is_reclassed_to(name, mapset, &nrmaps, &rmaps) <= 0)
 	return;
@@ -115,6 +116,10 @@
     G_message(_("Renaming reclass maps"));
 
     for (; *rmaps; rmaps++) {
+	char buf1[256], buf2[256], buf3[256], *str;
+	FILE *fp;
+	int ptr, l;
+
 	G_message(" %s", *rmaps);
 	sprintf(buf3, "%s", *rmaps);
 	if ((str = strchr(buf3, '@'))) {



More information about the grass-commit mailing list