[vhffs-dev] [1650] improved a bit vhffsfssync_pathname()

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1650
Author:   gradator
Date:     2011-04-16 17:33:59 +0200 (Sat, 16 Apr 2011)
Log Message:
-----------
improved a bit vhffsfssync_pathname()

Modified Paths:
--------------
    trunk/vhffs-fssync/vhffsfssync_master.c

Modified: trunk/vhffs-fssync/vhffsfssync_master.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_master.c	2011-04-16 15:31:00 UTC (rev 1649)
+++ trunk/vhffs-fssync/vhffsfssync_master.c	2011-04-16 15:33:59 UTC (rev 1650)
@@ -1225,7 +1225,7 @@
 
 char *vhffsfssync_pathname(vhffsfssync_watch *watch, const char *filename)  {
 
-	GString *pathname = g_string_sized_new(256);
+	GString *pathname;
 	char **dirnames, **curnames, **endnames;
 	uint32_t a;
 
@@ -1239,16 +1239,17 @@
 	}
 
 	while(watch) {
-		*(curnames++) = watch->dirname;
-		watch = watch->parent;
 		if(curnames == endnames) {
 			a += 16;
 			dirnames = realloc( dirnames, a * sizeof(char*) );
 			curnames = dirnames+a-16;
 			endnames = dirnames+a;
 		}
+		*(curnames++) = watch->dirname;
+		watch = watch->parent;
 	}
 
+	pathname = g_string_sized_new(256);
 	curnames--;
 	g_string_append(pathname, *(curnames--) );
 	while( curnames >= dirnames ) {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/