SF.net SVN: geany:[4473] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Dec 7 17:23:33 UTC 2009


Revision: 4473
          http://geany.svn.sourceforge.net/geany/?rev=4473&view=rev
Author:   ntrel
Date:     2009-12-07 17:23:33 +0000 (Mon, 07 Dec 2009)

Log Message:
-----------
Only show debug message once if recursive lexer_filetype is set.
Tidy highlighting_init_styles code for filetype None handling.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/highlighting.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-12-07 14:17:40 UTC (rev 4472)
+++ trunk/ChangeLog	2009-12-07 17:23:33 UTC (rev 4473)
@@ -6,6 +6,9 @@
    Add debug message warning if recursive lexer_filetype is set.
  * src/highlighting.c, src/sciwrappers.c, src/sciwrappers.h:
    Remove duplicate sci_set_keywords(), make argument const.
+ * src/highlighting.c:
+   Only show debug message once if recursive lexer_filetype is set.
+   Tidy highlighting_init_styles code for filetype None handling.
 
 
 2009-12-03  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2009-12-07 14:17:40 UTC (rev 4472)
+++ trunk/src/highlighting.c	2009-12-07 17:23:33 UTC (rev 4473)
@@ -3043,8 +3043,6 @@
 
 static gint get_lexer_filetype(GeanyFiletype *ft)
 {
-	/* TODO: some way of checking that lexer_filetype is supported here and not recursive (without
-	 * loading the config file) */
 	ft = NVL(ft->lexer_filetype, ft);
 	return ft->id;
 }
@@ -3062,19 +3060,22 @@
 	GeanyFiletype *ft = filetypes[filetype_idx];
 	gint lexer_id = get_lexer_filetype(ft);
 
+	/* None filetype handled specially */
+	if (filetype_idx == GEANY_FILETYPES_NONE)
+	{
+		styleset_common_init(GEANY_FILETYPES_NONE, config, configh);
+		return;
+	}
 	if (!style_sets)
 		style_sets = g_new0(StyleSet, filetypes_array->len);
 
 	/* Clear old information if necessary - e.g. when reloading config */
 	free_styleset(filetype_idx);
-
 	/* All stylesets depend on filetypes.common */
-	if (filetype_idx != GEANY_FILETYPES_NONE)
-		filetypes_load_config(GEANY_FILETYPES_NONE, FALSE);
+	filetypes_load_config(GEANY_FILETYPES_NONE, FALSE);
 
 	switch (lexer_id)
 	{
-		init_styleset_case(GEANY_FILETYPES_NONE,	styleset_common_init);
 		init_styleset_case(GEANY_FILETYPES_ADA,		styleset_ada_init);
 		init_styleset_case(GEANY_FILETYPES_ASM,		styleset_asm_init);
 		init_styleset_case(GEANY_FILETYPES_BASIC,	styleset_basic_init);
@@ -3114,12 +3115,15 @@
 		init_styleset_case(GEANY_FILETYPES_VHDL,	styleset_vhdl_init);
 		init_styleset_case(GEANY_FILETYPES_XML,		styleset_markup_init);
 		init_styleset_case(GEANY_FILETYPES_YAML,	styleset_yaml_init);
+		default:
+			if (ft->lexer_filetype)
+				geany_debug("Filetype %s has a recursive lexer_filetype %s set!",
+					ft->name, ft->lexer_filetype->name);
 	}
 	read_properties(ft, config, configh);
 
 	/* should be done in filetypes.c really: */
-	if (filetype_idx != GEANY_FILETYPES_NONE)
-		get_keyfile_wordchars(config, configh, &style_sets[filetype_idx].wordchars);
+	get_keyfile_wordchars(config, configh, &style_sets[filetype_idx].wordchars);
 }
 
 
@@ -3181,9 +3185,6 @@
 		styleset_case(GEANY_FILETYPES_YAML,		styleset_yaml);
 		case GEANY_FILETYPES_NONE:
 		default:
-			if (ft->lexer_filetype)
-				geany_debug("Filetype %s has a recursive lexer_filetype %s set!",
-					ft->name, ft->lexer_filetype->name);
 			styleset_default(sci, ft->id);
 	}
 	/* [lexer_properties] settings */


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