[GRASS-SVN] r65054 - grass/trunk/display/d.mon

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 14 12:45:20 PDT 2015


Author: hcho
Date: 2015-04-14 12:45:19 -0700 (Tue, 14 Apr 2015)
New Revision: 65054

Modified:
   grass/trunk/display/d.mon/list.c
Log:
d.mon: Allocate less memory

Modified: grass/trunk/display/d.mon/list.c
===================================================================
--- grass/trunk/display/d.mon/list.c	2015-04-14 19:41:44 UTC (rev 65053)
+++ grass/trunk/display/d.mon/list.c	2015-04-14 19:45:19 UTC (rev 65054)
@@ -52,7 +52,6 @@
     while ((dp = readdir(dirp)) != NULL) {
 	int ret;
 
-        *list = G_realloc(*list, (*n + 1) * sizeof(char *));
         if (!dp->d_name || dp->d_name[0] == '.')
 	    continue;
 
@@ -63,6 +62,7 @@
         if (ret != 0 || !S_ISDIR(s.st_mode))
             continue;
 
+        *list = G_realloc(*list, (*n + 1) * sizeof(char *));
         (*list)[*n] = dp->d_name;
         (*n)++;
     }



More information about the grass-commit mailing list