Add GEANY_MAX_BUILT_IN_FILETYPES for accessing built_in_filetypes[].

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-filetypes@2539 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-04-28 16:15:08 +00:00
parent 5340f2b9c8
commit 7ede716a9c
3 changed files with 11 additions and 8 deletions

View File

@ -6,6 +6,8 @@
Replace filetypes_get_from_uid() with filetypes_lookup_by_name().
Use a hash table for filetypes, but keep the old filetypes array
available for now.
* src/filetypes.c, src/filetypes.h:
Add GEANY_MAX_BUILT_IN_FILETYPES for accessing built_in_filetypes[].
2008-04-27 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -42,7 +42,7 @@
GHashTable *filetypes_hash = NULL; /**< Array of filetype pointers */
/* built-in filetypes only */
filetype *builtin_filetypes[GEANY_MAX_FILE_TYPES] = {NULL};
filetype *built_in_filetypes[GEANY_MAX_BUILT_IN_FILETYPES] = {NULL};
/* This is the order of unique ids used in the config file.
@ -480,11 +480,11 @@ static void fill_filetypes(void)
}
static void create_builtin_filetypes(void)
static void create_built_in_filetypes(void)
{
filetype_id ft_id;
for (ft_id = 0; ft_id < GEANY_MAX_FILE_TYPES; ft_id++)
for (ft_id = 0; ft_id < GEANY_MAX_BUILT_IN_FILETYPES; ft_id++)
{
filetypes[ft_id] = g_new0(filetype, 1);
filetypes[ft_id]->programs = g_new0(struct build_programs, 1);
@ -501,11 +501,11 @@ void filetypes_init_types()
g_return_if_fail(filetypes_hash == NULL);
create_builtin_filetypes();
create_built_in_filetypes();
filetypes_hash = g_hash_table_new(g_str_hash, g_str_equal);
for (ft_id = 0; ft_id < GEANY_MAX_FILE_TYPES; ft_id++)
for (ft_id = 0; ft_id < GEANY_MAX_BUILT_IN_FILETYPES; ft_id++)
{
filetypes_add(filetypes[ft_id]);
}

View File

@ -78,7 +78,8 @@ typedef enum
GEANY_FILETYPES_SQL,
GEANY_FILETYPES_ALL, /* must be last filetype, used for 'None' item. */
GEANY_MAX_FILE_TYPES
GEANY_MAX_BUILT_IN_FILETYPES,
GEANY_MAX_FILE_TYPES = GEANY_MAX_BUILT_IN_FILETYPES
} filetype_id;
/* Safe wrapper to get the id field of a possibly NULL filetype pointer. */
@ -121,8 +122,8 @@ struct filetype
struct build_actions *actions;
};
#define filetypes builtin_filetypes
extern filetype *builtin_filetypes[GEANY_MAX_FILE_TYPES];
#define filetypes built_in_filetypes
extern filetype *built_in_filetypes[GEANY_MAX_BUILT_IN_FILETYPES];
void filetypes_add(filetype *ft);