Browse Source

minor refactoring

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@36714 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 16 years ago
parent
commit
2509910a25
1 changed files with 3 additions and 3 deletions
  1. 3 3
      general/g.mapsets/main.c

+ 3 - 3
general/g.mapsets/main.c

@@ -268,10 +268,10 @@ int main(int argc, char *argv[])
 
 
 static void append_mapset(char **path, const char *mapset)
 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';
         *path[0] = '\0';
     strcat(*path, mapset);
     strcat(*path, mapset);
     strcat(*path, " ");
     strcat(*path, " ");