SF.net SVN: geany: [2546] branches/custom-filetypes
ntrel at users.sourceforge.net
ntrel at xxxxx
Thu May 1 17:01:41 UTC 2008
Revision: 2546
http://geany.svn.sourceforge.net/geany/?rev=2546&view=rev
Author: ntrel
Date: 2008-05-01 10:01:32 -0700 (Thu, 01 May 2008)
Log Message:
-----------
Remove filetypes_find(), which will be replaced with a dynamic array
of filetype pointers (more flexible and backwards compatible with
existing code).
Modified Paths:
--------------
branches/custom-filetypes/ChangeLog
branches/custom-filetypes/src/filetypes.c
branches/custom-filetypes/src/filetypes.h
Modified: branches/custom-filetypes/ChangeLog
===================================================================
--- branches/custom-filetypes/ChangeLog 2008-05-01 14:51:47 UTC (rev 2545)
+++ branches/custom-filetypes/ChangeLog 2008-05-01 17:01:32 UTC (rev 2546)
@@ -10,6 +10,10 @@
in filetypes_hash.
* src/filetypes.c:
Add filetypes_new() to create and initialize a new filetype.
+ * src/filetypes.c, src/filetypes.h:
+ Remove filetypes_find(), which will be replaced with a dynamic array
+ of filetype pointers (more flexible and backwards compatible with
+ existing code).
2008-04-29 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: branches/custom-filetypes/src/filetypes.c
===================================================================
--- branches/custom-filetypes/src/filetypes.c 2008-05-01 14:51:47 UTC (rev 2545)
+++ branches/custom-filetypes/src/filetypes.c 2008-05-01 17:01:32 UTC (rev 2546)
@@ -515,12 +515,12 @@
}
-static gboolean match_basename(G_GNUC_UNUSED const gchar *ft_name, filetype *ft,
- gpointer user_data)
+static gboolean match_basename(G_GNUC_UNUSED gpointer key, gpointer value, gpointer user_data)
{
- gboolean ret = FALSE;
+ filetype *ft = value;
const gchar *base_filename = user_data;
gint j;
+ gboolean ret = FALSE;
/* Don't match '*' because it comes before any custom filetypes */
if (ft->id == GEANY_FILETYPES_ALL)
@@ -556,7 +556,7 @@
setptr(base_filename, g_utf8_strdown(base_filename, -1));
#endif
- ft = filetypes_find(match_basename, base_filename);
+ ft = g_hash_table_find(filetypes_hash, match_basename, base_filename);
if (ft == NULL)
ft = filetypes[GEANY_FILETYPES_ALL];
@@ -1040,10 +1040,3 @@
}
-/* Call a predicate function for each filetype until it returns TRUE. */
-filetype *filetypes_find(FileTypePredicate predicate, gpointer user_data)
-{
- return g_hash_table_find(filetypes_hash, (GHRFunc) predicate, user_data);
-}
-
-
Modified: branches/custom-filetypes/src/filetypes.h
===================================================================
--- branches/custom-filetypes/src/filetypes.h 2008-05-01 14:51:47 UTC (rev 2545)
+++ branches/custom-filetypes/src/filetypes.h 2008-05-01 17:01:32 UTC (rev 2546)
@@ -131,13 +131,7 @@
filetype *filetypes_lookup_by_name(const gchar *name);
-/* This can be cast to GHRFunc */
-typedef gboolean (*FileTypePredicate) (const gchar *ft_name, filetype *ft,
- gpointer user_data);
-filetype *filetypes_find(FileTypePredicate predicate, gpointer user_data);
-
-
/* Calls filetypes_init_types() and creates the filetype menu. */
void filetypes_init(void);
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