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:
parent
5340f2b9c8
commit
7ede716a9c
@ -6,6 +6,8 @@
|
|||||||
Replace filetypes_get_from_uid() with filetypes_lookup_by_name().
|
Replace filetypes_get_from_uid() with filetypes_lookup_by_name().
|
||||||
Use a hash table for filetypes, but keep the old filetypes array
|
Use a hash table for filetypes, but keep the old filetypes array
|
||||||
available for now.
|
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>
|
2008-04-27 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
GHashTable *filetypes_hash = NULL; /**< Array of filetype pointers */
|
GHashTable *filetypes_hash = NULL; /**< Array of filetype pointers */
|
||||||
|
|
||||||
/* built-in filetypes only */
|
/* 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.
|
/* 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;
|
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] = g_new0(filetype, 1);
|
||||||
filetypes[ft_id]->programs = g_new0(struct build_programs, 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);
|
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);
|
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]);
|
filetypes_add(filetypes[ft_id]);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,8 @@ typedef enum
|
|||||||
GEANY_FILETYPES_SQL,
|
GEANY_FILETYPES_SQL,
|
||||||
|
|
||||||
GEANY_FILETYPES_ALL, /* must be last filetype, used for 'None' item. */
|
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;
|
} filetype_id;
|
||||||
|
|
||||||
/* Safe wrapper to get the id field of a possibly NULL filetype pointer. */
|
/* Safe wrapper to get the id field of a possibly NULL filetype pointer. */
|
||||||
@ -121,8 +122,8 @@ struct filetype
|
|||||||
struct build_actions *actions;
|
struct build_actions *actions;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define filetypes builtin_filetypes
|
#define filetypes built_in_filetypes
|
||||||
extern filetype *builtin_filetypes[GEANY_MAX_FILE_TYPES];
|
extern filetype *built_in_filetypes[GEANY_MAX_BUILT_IN_FILETYPES];
|
||||||
|
|
||||||
|
|
||||||
void filetypes_add(filetype *ft);
|
void filetypes_add(filetype *ft);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user