--- projects/libstatgrab/src/statgrab/statgrab.c 2005/09/24 13:29:25 1.36 +++ projects/libstatgrab/src/statgrab/statgrab.c 2006/03/17 13:23:05 1.37 @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: statgrab.c,v 1.36 2005/09/24 13:29:25 tdb Exp $ + * $Id: statgrab.c,v 1.37 2006/03/17 13:23:05 ats Exp $ */ #ifdef HAVE_CONFIG_H @@ -121,17 +121,18 @@ void add_stat(stat_type type, void *stat, ...) { break; partlen = strlen(part); memcpy(p, part, partlen); - p += partlen; + + /* Replace spaces and dots with underscores. */ + while (partlen-- > 0) { + if (*p == ' ' || *p == '.') + *p = '_'; + p++; + } + *p++ = '.'; } va_end(ap); *--p = '\0'; - - /* Replace spaces with underscores. */ - for (p = name; *p != '\0'; p++) { - if (*p == ' ') - *p = '_'; - } /* Stretch the stats array if necessary. */ if (num_stats >= alloc_stats) {