[GRASS-SVN] r64071 - grass/branches/releasebranch_7_0/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 12 00:38:13 PST 2015


Author: mmetz
Date: 2015-01-12 00:38:13 -0800 (Mon, 12 Jan 2015)
New Revision: 64071

Modified:
   grass/branches/releasebranch_7_0/lib/gis/strings.c
Log:
libgis: sync G_chop() to trunk

Modified: grass/branches/releasebranch_7_0/lib/gis/strings.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/gis/strings.c	2015-01-12 02:32:13 UTC (rev 64070)
+++ grass/branches/releasebranch_7_0/lib/gis/strings.c	2015-01-12 08:38:13 UTC (rev 64071)
@@ -295,15 +295,17 @@
 	return (line);
     }
 
-    for (t = line; *t; t++)	/* go to end */
+    for (t = f; *t; t++)	/* go from first non white-space char to end */
 	;
     while (isspace(*--t)) ;
     *++t = '\0';		/* remove trailing white-spaces */
 
-    t = line;
-    while (*f)			/* copy */
-	*t++ = *f++;
-    *t = '\0';
+    if (f != line) {
+	t = line;
+	while (*f)		/* leading white spaces, shift */
+	    *t++ = *f++;
+	*t = '\0';
+    }
 
     return (line);
 }



More information about the grass-commit mailing list