[GRASS-SVN] r36714 - grass/trunk/general/g.mapsets
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 13 04:24:19 EDT 2009
Author: hcho
Date: 2009-04-13 04:24:19 -0400 (Mon, 13 Apr 2009)
New Revision: 36714
Modified:
grass/trunk/general/g.mapsets/main.c
Log:
minor refactoring
Modified: grass/trunk/general/g.mapsets/main.c
===================================================================
--- grass/trunk/general/g.mapsets/main.c 2009-04-13 07:51:14 UTC (rev 36713)
+++ grass/trunk/general/g.mapsets/main.c 2009-04-13 08:24:19 UTC (rev 36714)
@@ -268,10 +268,10 @@
static void append_mapset(char **path, const char *mapset)
{
- int init = (*path == NULL);
+ int len = (*path == NULL ? 0 : strlen(*path));
- *path = (char *)G_realloc(*path, (init ? 0 : strlen(*path)) + strlen(mapset) + 2);
- if (init)
+ *path = (char *)G_realloc(*path, len + strlen(mapset) + 2);
+ if (!len)
*path[0] = '\0';
strcat(*path, mapset);
strcat(*path, " ");
More information about the grass-commit
mailing list