SF.net SVN: geany:[5731] trunk/src/editor.c
ntrel at users.sourceforge.net
ntrel at xxxxx
Tue Apr 19 16:43:23 UTC 2011
Revision: 5731
http://geany.svn.sourceforge.net/geany/?rev=5731&view=rev
Author: ntrel
Date: 2011-04-19 16:43:23 +0000 (Tue, 19 Apr 2011)
Log Message:
-----------
Remove snippets_global_pattern global and use user_data instead.
Modified Paths:
--------------
trunk/src/editor.c
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2011-04-19 16:36:29 UTC (rev 5730)
+++ trunk/src/editor.c 2011-04-19 16:43:23 UTC (rev 5731)
@@ -2289,22 +2289,17 @@
}
-/* This is very ugly but passing the pattern to ac_replace_specials() doesn't work because it is
- * modified when replacing a completion but the foreach function still passes the old pointer
- * to ac_replace_specials, so we use a global pointer outside of ac_replace_specials and
- * ac_complete_constructs. Any hints to improve this are welcome. */
-static GString *snippets_global_pattern = NULL;
-
static void snippets_replace_specials(gpointer key, gpointer value, gpointer user_data)
{
gchar *needle;
+ GString *pattern = user_data;
g_return_if_fail(key != NULL);
g_return_if_fail(value != NULL);
needle = g_strconcat("%", (gchar*) key, "%", NULL);
- utils_string_replace_all(snippets_global_pattern, needle, (gchar*) value);
+ utils_string_replace_all(pattern, needle, (gchar*) value);
g_free(needle);
}
@@ -2502,9 +2497,7 @@
specials = g_hash_table_lookup(snippet_hash, "Special");
if (G_LIKELY(specials != NULL))
{
- /* ugly hack using global_pattern */
- snippets_global_pattern = pattern;
- g_hash_table_foreach(specials, snippets_replace_specials, NULL);
+ g_hash_table_foreach(specials, snippets_replace_specials, pattern);
}
/* now transform other wildcards */
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