SF.net SVN: geany-plugins:[1934] trunk/geany-plugins/treebrowser/src/ treebrowser.c

dimitrov-adrian at users.sourceforge.net dimitrov-adrian at xxxxx
Mon Feb 14 22:41:50 UTC 2011


Revision: 1934
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1934&view=rev
Author:   dimitrov-adrian
Date:     2011-02-14 22:41:50 +0000 (Mon, 14 Feb 2011)

Log Message:
-----------


Modified Paths:
--------------
    trunk/geany-plugins/treebrowser/src/treebrowser.c

Modified: trunk/geany-plugins/treebrowser/src/treebrowser.c
===================================================================
--- trunk/geany-plugins/treebrowser/src/treebrowser.c	2011-02-14 22:10:31 UTC (rev 1933)
+++ trunk/geany-plugins/treebrowser/src/treebrowser.c	2011-02-14 22:41:50 UTC (rev 1934)
@@ -227,33 +227,39 @@
 {
 	int i = 0;
 
-	gchar *diffed_path = "";
+	gboolean founded = FALSE;
+	gchar *diffed_path = "", *tmp = NULL;
 	gchar **src_segments = NULL, **find_segments = NULL;
 	guint src_segments_n = 0, find_segments_n = 0, n = 0;
 
 	src_segments = g_strsplit(src, G_DIR_SEPARATOR_S, 0);
 	find_segments = g_strsplit(find, G_DIR_SEPARATOR_S, 0);
 
-	src_segments_n = g_strv_length(src_segments)-1;
-	find_segments_n = g_strv_length(find_segments)-1;
+	src_segments_n = g_strv_length(src_segments);
+	find_segments_n = g_strv_length(find_segments);
 
 	n = src_segments_n;
 	if (find_segments_n < n)
 		n = find_segments_n;
 
-	for(i = 1; i<=n; i++)
-		if (g_strcmp0(find_segments[i], src_segments[i])!=0)
+	for(i = 1; i<n; i++)
+		if (utils_str_equal(find_segments[i], src_segments[i]) != TRUE)
 		{
 			diffed_path = NULL;
 			break;
 		}
 		else
-			diffed_path = g_strconcat(diffed_path, G_DIR_SEPARATOR_S, find_segments[i], NULL);
+		{
+			tmp = g_strconcat(diffed_path, G_DIR_SEPARATOR_S, find_segments[i], NULL);
+			diffed_path = g_strdup(tmp);
+			g_free(tmp);
+			founded = TRUE;
+		}
 
 	g_strfreev(src_segments);
 	g_strfreev(find_segments);
 
-	return diffed_path;
+	return (founded ? diffed_path : NULL);
 }
 
 /* Return: FALSE - if file is filtered and not shown, and TRUE - if file isn`t filtered, and have to be shown */
@@ -794,7 +800,6 @@
 
 		if (founded)
 		{
-			printf("\n* %s", new);
 			if (treebrowser_search(new, NULL))
 				global_founded = TRUE;
 		}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list