Kaydet (Commit) 21eb6bd9 authored tarafından Nick Treleaven's avatar Nick Treleaven

Remove filetypes_find(), which will be replaced with a dynamic array

of filetype pointers (more flexible and backwards compatible with
existing code).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-filetypes@2546 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 75a1cf7f
......@@ -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>
......
......@@ -515,12 +515,12 @@ void filetypes_init()
}
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 @@ filetype *filetypes_detect_from_extension(const gchar *utf8_filename)
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 @@ filetype *filetypes_lookup_by_name(const gchar *name)
}
/* 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);
}
......@@ -131,12 +131,6 @@ void filetypes_remove(filetype *ft);
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment