Remove an unnecessary macro indirection

This commit is contained in:
Colomban Wendling 2011-11-11 20:02:59 +01:00
parent 511d5276a3
commit d8d6f2908e
2 changed files with 15 additions and 20 deletions

View File

@ -809,14 +809,6 @@ static void styleset_init_from_mapping(guint ft_id, GKeyFile *config, GKeyFile *
}
#define STYLESET_INIT_FROM_MAPPING(ft_id, config, config_home, lang_name) \
styleset_init_from_mapping(ft_id, config, config_home, \
highlighting_styles_##lang_name, \
highlighting_styles_##lang_name ? G_N_ELEMENTS(highlighting_styles_##lang_name) : 0, \
highlighting_keywords_##lang_name, \
highlighting_keywords_##lang_name ? G_N_ELEMENTS(highlighting_keywords_##lang_name) : 0)
/* STYLE_DEFAULT will be set to match the first style. */
static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer,
const HLStyle *styles, gsize n_styles,
@ -859,16 +851,6 @@ static void styleset_from_mapping(ScintillaObject *sci, guint ft_id, guint lexer
}
#define STYLESET_FROM_MAPPING(sci, ft_id, lang_name) \
styleset_from_mapping(sci, ft_id, highlighting_lexer_##lang_name, \
highlighting_styles_##lang_name, \
highlighting_styles_##lang_name ? G_N_ELEMENTS(highlighting_styles_##lang_name) : 0, \
highlighting_keywords_##lang_name, \
highlighting_keywords_##lang_name ? G_N_ELEMENTS(highlighting_keywords_##lang_name) : 0, \
highlighting_properties_##lang_name, \
highlighting_properties_##lang_name ? G_N_ELEMENTS(highlighting_properties_##lang_name) : 0)
static void styleset_default(ScintillaObject *sci, guint ft_id)
{
@ -933,7 +915,11 @@ static guint get_lexer_filetype(GeanyFiletype *ft)
#define init_styleset_case(LANG_NAME) \
case (GEANY_FILETYPES_##LANG_NAME): \
STYLESET_INIT_FROM_MAPPING(filetype_idx, config, configh, LANG_NAME); \
styleset_init_from_mapping(filetype_idx, config, configh, \
highlighting_styles_##LANG_NAME, \
HL_N_ENTRIES(highlighting_styles_##LANG_NAME), \
highlighting_keywords_##LANG_NAME, \
HL_N_ENTRIES(highlighting_keywords_##LANG_NAME)); \
break
/* Called by filetypes_load_config(). */
@ -1019,7 +1005,13 @@ void highlighting_init_styles(guint filetype_idx, GKeyFile *config, GKeyFile *co
#define styleset_case(LANG_NAME) \
case (GEANY_FILETYPES_##LANG_NAME): \
STYLESET_FROM_MAPPING(sci, ft->id, LANG_NAME); \
styleset_from_mapping(sci, ft->id, highlighting_lexer_##LANG_NAME, \
highlighting_styles_##LANG_NAME, \
HL_N_ENTRIES(highlighting_styles_##LANG_NAME), \
highlighting_keywords_##LANG_NAME, \
HL_N_ENTRIES(highlighting_keywords_##LANG_NAME), \
highlighting_properties_##LANG_NAME, \
HL_N_ENTRIES(highlighting_properties_##LANG_NAME)); \
break
/** Sets up highlighting and other visual settings.

View File

@ -92,6 +92,9 @@ typedef struct
#define EMPTY_KEYWORDS ((HLKeyword *) NULL)
#define EMPTY_PROPERTIES ((HLProperty *) NULL)
/* like G_N_ELEMENTS() but supports @array being NULL (for empty entries) */
#define HL_N_ENTRIES(array) ((array) ? G_N_ELEMENTS(array) : 0)
/* Ada */
#define highlighting_lexer_ADA SCLEX_ADA