SF.net SVN: geany:[5323] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Oct 25 17:24:48 UTC 2010


Revision: 5323
          http://geany.svn.sourceforge.net/geany/?rev=5323&view=rev
Author:   ntrel
Date:     2010-10-25 17:24:47 +0000 (Mon, 25 Oct 2010)

Log Message:
-----------
Remove unnecessary uses of FILETYPE_ID() macro with
GeanyDocument::file_type.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/saveactions.c
    trunk/src/build.c
    trunk/src/document.c
    trunk/src/editor.c
    trunk/src/symbols.c
    trunk/src/templates.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-10-25 16:58:13 UTC (rev 5322)
+++ trunk/ChangeLog	2010-10-25 17:24:47 UTC (rev 5323)
@@ -12,6 +12,10 @@
    Auto-indent after an HTML/XML line with a missing closing tag (patch
    by Eugene Arshinov, thanks).
    Behaviour only applies if XML tag autoclosing is off.
+ * src/templates.c, src/build.c, src/document.c, src/editor.c,
+   src/symbols.c, plugins/saveactions.c:
+   Remove unnecessary uses of FILETYPE_ID() macro with
+   GeanyDocument::file_type.
 
 
 2010-10-22  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/plugins/saveactions.c
===================================================================
--- trunk/plugins/saveactions.c	2010-10-25 16:58:13 UTC (rev 5322)
+++ trunk/plugins/saveactions.c	2010-10-25 17:24:47 UTC (rev 5323)
@@ -261,7 +261,7 @@
 
 		doc->file_name = new_filename;
 
-		if (FILETYPE_ID(doc->file_type) == GEANY_FILETYPES_NONE)
+		if (doc->file_type->id == GEANY_FILETYPES_NONE)
 			document_set_filetype(doc, filetypes_lookup_by_name(instantsave_default_ft));
 
 		/* force saving the file to enable all the related actions(tab name, filetype, etc.) */

Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c	2010-10-25 16:58:13 UTC (rev 5322)
+++ trunk/src/build.c	2010-10-25 17:24:47 UTC (rev 5323)
@@ -723,7 +723,7 @@
 	/* set the build info for the message window */
 	g_free(build_info.dir);
 	build_info.dir = g_strdup(working_dir);
-	build_info.file_type_id = (doc == NULL) ? GEANY_FILETYPES_NONE : FILETYPE_ID(doc->file_type);
+	build_info.file_type_id = (doc == NULL) ? GEANY_FILETYPES_NONE : doc->file_type->id;
 	build_info.message_count = 0;
 
 #ifdef G_OS_WIN32
@@ -863,7 +863,7 @@
 	if (working_dir == NULL)
 		return (GPid) 0;
 
-	run_info[cmdindex].file_type_id = FILETYPE_ID(doc->file_type);
+	run_info[cmdindex].file_type_id = doc->file_type->id;
 
 #ifdef HAVE_VTE
 	if (vte_info.load_vte && vc != NULL && vc->run_in_vte)

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2010-10-25 16:58:13 UTC (rev 5322)
+++ trunk/src/document.c	2010-10-25 17:24:47 UTC (rev 5323)
@@ -1156,7 +1156,7 @@
 	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(NULL);
 	GeanyIndentType type = iprefs->type;
 
-	switch (FILETYPE_ID(doc->file_type))
+	switch (doc->file_type->id)
 	{
 		case GEANY_FILETYPES_MAKE:
 			/* force using tabs for indentation for Makefiles */
@@ -1166,6 +1166,8 @@
 			/* force using spaces for indentation for Fortran 77 */
 			editor_set_indent(doc->editor, GEANY_INDENT_TYPE_SPACES, iprefs->width);
 			return;
+		default:
+			break;
 	}
 	if (iprefs->detect_type)
 	{
@@ -1616,7 +1618,7 @@
 	setptr(doc->real_path, NULL);
 
 	/* detect filetype */
-	if (FILETYPE_ID(doc->file_type) == GEANY_FILETYPES_NONE)
+	if (doc->file_type->id == GEANY_FILETYPES_NONE)
 	{
 		GeanyFiletype *ft = filetypes_detect_from_document(doc);
 
@@ -1793,7 +1795,7 @@
 	}
 
 	/* replaces tabs by spaces but only if the current file is not a Makefile */
-	if (file_prefs.replace_tabs && FILETYPE_ID(doc->file_type) != GEANY_FILETYPES_MAKE)
+	if (file_prefs.replace_tabs && doc->file_type->id != GEANY_FILETYPES_MAKE)
 		editor_replace_tabs(doc->editor);
 	/* strip trailing spaces */
 	if (file_prefs.strip_trailing_spaces)
@@ -2404,7 +2406,7 @@
 	g_return_val_if_fail(doc != NULL, FALSE);
 	sci = doc->editor->sci;
 
-	switch (FILETYPE_ID(doc->file_type))
+	switch (doc->file_type->id)
 	{	/* continue working with the following languages, skip on all others */
 		case GEANY_FILETYPES_C:
 		case GEANY_FILETYPES_CPP:

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2010-10-25 16:58:13 UTC (rev 5322)
+++ trunk/src/editor.c	2010-10-25 17:24:47 UTC (rev 5323)
@@ -1352,15 +1352,15 @@
 		if (lexer_has_braces(sci))
 			additional_indent = iprefs->width * get_brace_indent(sci, line);
 		else
-		if (FILETYPE_ID(editor->document->file_type) == GEANY_FILETYPES_PYTHON)
+		if (editor->document->file_type->id == GEANY_FILETYPES_PYTHON)
 			additional_indent = iprefs->width * get_python_indent(sci, line);
 
 		/* HTML lexer "has braces" because of PHP and JavaScript.  If get_brace_indent() did not
 		 * recommend us to insert additional indent, we are probably not in PHP/JavaScript chunk and
 		 * should make the XML-related check */
 		if (additional_indent == 0 && !editor_prefs.auto_close_xml_tags &&
-			(FILETYPE_ID(editor->document->file_type) == GEANY_FILETYPES_HTML ||
-			FILETYPE_ID(editor->document->file_type) == GEANY_FILETYPES_XML))
+			(editor->document->file_type->id == GEANY_FILETYPES_HTML ||
+			editor->document->file_type->id == GEANY_FILETYPES_XML))
 		{
 			size += iprefs->width * get_xml_indent(sci, line);
 		}
@@ -1887,7 +1887,7 @@
 	g_return_val_if_fail(editor != NULL, NULL);
 
 	str = g_string_new(NULL);
-	if (append_calltip(str, tag, FILETYPE_ID(editor->document->file_type)))
+	if (append_calltip(str, tag, editor->document->file_type->id))
 		return g_string_free(str, FALSE);
 	else
 		return g_string_free(str, TRUE);
@@ -2519,7 +2519,7 @@
 	GString *pattern;
 	gssize cur_index = -1;
 	gint str_len;
-	gint ft_id = FILETYPE_ID(editor->document->file_type);
+	gint ft_id = editor->document->file_type->id;
 
 	str = g_strdup(word);
 	g_strstrip(str);

Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c	2010-10-25 16:58:13 UTC (rev 5322)
+++ trunk/src/symbols.c	2010-10-25 17:24:47 UTC (rev 5323)
@@ -949,7 +949,7 @@
 	if (!found_parent && scope &&
 		strpbrk(scope, GEANY_WORDCHARS) == scope)
 	{
-		const gchar *sep = symbols_get_context_separator(FILETYPE_ID(doc->file_type));
+		const gchar *sep = symbols_get_context_separator(doc->file_type->id);
 
 		g_string_append(buffer, scope);
 		g_string_append(buffer, sep);
@@ -1096,7 +1096,7 @@
 
 static void add_tree_tag(GeanyDocument *doc, const TMTag *tag, GHashTable *parent_hash)
 {
-	filetype_id ft_id = FILETYPE_ID(doc->file_type);
+	filetype_id ft_id = doc->file_type->id;
 	GtkTreeStore *tree_store = doc->priv->tag_store;
 	GtkTreeIter *parent = NULL;
 
@@ -1172,7 +1172,7 @@
 	for (item = tags; item; item = g_list_next(item))
 	{
 		const TMTag *tag = item->data;
-		const gchar *name = get_parent_name(tag, FILETYPE_ID(doc->file_type));
+		const gchar *name = get_parent_name(tag, doc->file_type->id);
 
 		if (name)
 			g_hash_table_insert(parent_hash, (gpointer)name, NULL);
@@ -1587,7 +1587,7 @@
 static gint get_function_fold_number(GeanyDocument *doc)
 {
 	/* for Java the functions are always one fold level above the class scope */
-	if (FILETYPE_ID(doc->file_type) == GEANY_FILETYPES_JAVA)
+	if (doc->file_type->id == GEANY_FILETYPES_JAVA)
 		return SC_FOLDLEVELBASE + 1;
 	else
 		return SC_FOLDLEVELBASE;

Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c	2010-10-25 16:58:13 UTC (rev 5322)
+++ trunk/src/templates.c	2010-10-25 17:24:47 UTC (rev 5323)
@@ -540,7 +540,7 @@
 	templates_replace_default_dates(template);
 	templates_replace_command(template, DOC_FILENAME(doc), doc->file_type->name, NULL);
 
-	make_comment_block(template, FILETYPE_ID(doc->file_type), 8);
+	make_comment_block(template, doc->file_type->id, 8);
 	convert_eol_characters(template, doc);
 
 	return g_string_free(template, FALSE);


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