SF.net SVN: geany:[4551] trunk/src/editor.c

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Jan 25 15:45:27 UTC 2010


Revision: 4551
          http://geany.svn.sourceforge.net/geany/?rev=4551&view=rev
Author:   ntrel
Date:     2010-01-25 15:45:27 +0000 (Mon, 25 Jan 2010)

Log Message:
-----------
Avoid some unnecessary reallocations, add comment.

Modified Paths:
--------------
    trunk/src/editor.c

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2010-01-24 20:25:17 UTC (rev 4550)
+++ trunk/src/editor.c	2010-01-25 15:45:27 UTC (rev 4551)
@@ -1795,6 +1795,7 @@
 	flags = SCFIND_WORDSTART | SCFIND_MATCHCASE;
 
 	words = g_string_sized_new(256);
+	/* put space before first entry to make searching with strstr easy */
 	g_string_append_c(words, ' ');
 
 	/* search the whole document for the word root and collect results */
@@ -1872,7 +1873,7 @@
 	}
 	list = g_slist_sort(list, (GCompareFunc)utils_str_casecmp);
 
-	str = g_string_sized_new(256);
+	str = g_string_sized_new(words->len);
 	foreach_slist(node, list)
 	{
 		g_string_append(str, node->data);


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



More information about the Commits mailing list