[geany/geany] 7be40f: Initialize ctags at a single place instead of four

Jiří Techet git-noreply at xxxxx
Fri Jun 10 21:57:18 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Mon, 21 Mar 2016 17:28:36 UTC
Commit:      7be40f5832c082ca27bce5e4756c602b5d022580
             https://github.com/geany/geany/commit/7be40f5832c082ca27bce5e4756c602b5d022580

Log Message:
-----------
Initialize ctags at a single place instead of four


Modified Paths:
--------------
    src/libmain.c
    tagmanager/src/tm_source_file.c
    tagmanager/src/tm_source_file.h
    tagmanager/src/tm_workspace.c

Modified: src/libmain.c
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -251,7 +251,6 @@ static void main_init(void)
 	file_prefs.tab_order_beside		= FALSE;
 	main_status.quitting			= FALSE;
 	ignore_callback	= FALSE;
-	app->tm_workspace		= tm_get_workspace();
 	ui_prefs.recent_queue				= g_queue_new();
 	ui_prefs.recent_projects_queue		= g_queue_new();
 	main_status.opening_session_files	= FALSE;
@@ -1047,6 +1046,8 @@ gint main_lib(gint argc, gchar **argv)
 #ifdef ENABLE_NLS
 	main_locale_init(utils_resource_dir(RESOURCE_DIR_LOCALE), GETTEXT_PACKAGE);
 #endif
+	/* initialize TM before parsing command-line - needed for tag file generation */
+	app->tm_workspace = tm_get_workspace();
 	parse_command_line_options(&argc, &argv);
 
 #if ! GLIB_CHECK_VERSION(2, 32, 0)


Modified: tagmanager/src/tm_source_file.c
36 lines changed, 7 insertions(+), 29 deletions(-)
===================================================================
@@ -159,6 +159,13 @@ static int tm_source_file_tags(const tagEntryInfo *tag)
 	return TRUE;
 }
 
+void tm_source_file_ctags_init()
+{
+	initializeParsing();
+	installLanguageMapDefaults();
+	TagEntryFunction = tm_source_file_tags;
+}
+
 /* Initializes a TMSourceFile structure from a file name. */
 static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name, 
 	const char* name)
@@ -193,14 +200,6 @@ static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_
 
 	source_file->tags_array = g_ptr_array_new();
 
-	if (NULL == LanguageTable)
-	{
-		initializeParsing();
-		installLanguageMapDefaults();
-		if (NULL == TagEntryFunction)
-			TagEntryFunction = tm_source_file_tags;
-	}
-
 	if (name == NULL)
 		source_file->lang = TM_PARSER_NONE;
 	else
@@ -341,13 +340,6 @@ gboolean tm_source_file_parse(TMSourceFile *source_file, guchar* text_buf, gsize
 		return TRUE;
 	}
 
-	if (NULL == LanguageTable)
-	{
-		initializeParsing();
-		installLanguageMapDefaults();
-		if (NULL == TagEntryFunction)
-			TagEntryFunction = tm_source_file_tags;
-	}
 	current_source_file = source_file;
 	if (! LanguageTable [source_file->lang]->enabled)
 	{
@@ -407,13 +399,6 @@ gboolean tm_source_file_parse(TMSourceFile *source_file, guchar* text_buf, gsize
 */
 const gchar *tm_source_file_get_lang_name(TMParserType lang)
 {
-	if (NULL == LanguageTable)
-	{
-		initializeParsing();
-		installLanguageMapDefaults();
-		if (NULL == TagEntryFunction)
-			TagEntryFunction = tm_source_file_tags;
-	}
 	return getLanguageName(lang);
 }
 
@@ -423,13 +408,6 @@ const gchar *tm_source_file_get_lang_name(TMParserType lang)
 */
 TMParserType tm_source_file_get_named_lang(const gchar *name)
 {
-	if (NULL == LanguageTable)
-	{
-		initializeParsing();
-		installLanguageMapDefaults();
-		if (NULL == TagEntryFunction)
-			TagEntryFunction = tm_source_file_tags;
-	}
 	return getNamedLanguage(name);
 }
 


Modified: tagmanager/src/tm_source_file.h
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -45,6 +45,8 @@ typedef struct TMSourceFile
 
 GType tm_source_file_get_type(void);
 
+void tm_source_file_ctags_init();
+
 TMSourceFile *tm_source_file_new(const char *file_name, const char *name);
 
 void tm_source_file_free(TMSourceFile *source_file);


Modified: tagmanager/src/tm_workspace.c
3 lines changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -72,6 +72,9 @@ static gboolean tm_create_workspace(void)
 	theWorkspace->source_files = g_ptr_array_new();
 	theWorkspace->typename_array = g_ptr_array_new();
 	theWorkspace->global_typename_array = g_ptr_array_new();
+
+	tm_source_file_ctags_init();
+
 	return TRUE;
 }
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list