[geany/geany] 62332e: Since lang is now always part of TMTag, always set its value

Jiří Techet git-noreply at xxxxx
Sat Nov 8 18:57:55 UTC 2014


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Sat, 18 Oct 2014 19:40:11 UTC
Commit:      62332e19aa9182593dccea5f21fcd1c34b99f144
             https://github.com/geany/geany/commit/62332e19aa9182593dccea5f21fcd1c34b99f144

Log Message:
-----------
Since lang is now always part of TMTag, always set its value

This makes it less confusing for code accessing TMTag so it can always
find the language in tag->lang and there is no need to access it through
tag->file.lang.


Modified Paths:
--------------
    src/symbols.c
    tagmanager/src/tm_tag.c
    tagmanager/src/tm_tag.h
    tagmanager/src/tm_workspace.c

Modified: src/symbols.c
5 lines changed, 1 insertions(+), 4 deletions(-)
===================================================================
@@ -266,10 +266,7 @@ GString *symbols_find_tags_as_string(GPtrArray *tags_array, guint tag_types, gin
 		for (j = 0; j < typedefs->len; ++j)
 		{
 			tag = TM_TAG(typedefs->pdata[j]);
-			/* tag->atts.file.lang contains the line of the tag if tag->file 
-			 * is not NULL (geany document); otherwise it's a global tag with lang 
-			 * information in tag->lang */
-			tag_lang = (tag->file) ? tag->file->lang : tag->lang;
+			tag_lang = tag->lang;
 
 			/* the check for tag_lang == lang is necessary to avoid wrong type colouring of
 			 * e.g. PHP classes in C++ files


Modified: tagmanager/src/tm_tag.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -254,6 +254,7 @@ static gboolean tm_tag_init(TMTag *tag, TMSourceFile *file, const tagEntryInfo *
 		if ((tm_tag_macro_t == tag->type) && (NULL != tag->arglist))
 			tag->type = tm_tag_macro_with_arg_t;
 		tag->file = file;
+		tag->lang = file->lang;
 		return TRUE;
 	}
 }


Modified: tagmanager/src/tm_tag.h
4 lines changed, 1 insertions(+), 3 deletions(-)
===================================================================
@@ -136,9 +136,7 @@ typedef struct _TMTag
 	char *var_type; /**< Variable type (maps to struct for typedefs) */
 	char access; /**< Access type (public/protected/private/etc.) */
 	char impl; /**< Implementation (e.g. virtual) */
-	
-	langType lang; /**< Programming language of the file - set only for
-						global tags when the file member is NULL */
+	langType lang; /**< Programming language of the file */
 
 	gint refcount; /**< the reference count of the tag */
 } TMTag;


Modified: tagmanager/src/tm_workspace.c
6 lines changed, 1 insertions(+), 5 deletions(-)
===================================================================
@@ -611,9 +611,7 @@ const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *at
 	/* file tags */
 	if (matches[0] && *matches[0])
 	{
-		/* tag->atts.file.lang contains the line of the tag and
-		 * tags->file->lang contains the language */
-		tags_lang = (*matches[0])->file->lang;
+		tags_lang = (*matches[0])->lang;
 
 		for (tagIter=0;tagIter<tagCount[0];++tagIter)
 		{
@@ -637,8 +635,6 @@ const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *at
 	if (matches[1] && *matches[1])
 	{
 		int tags_lang_alt = 0;
-		/* tag->atts.file.lang contains the language and
-		 * tags->file is NULL */
 		tags_lang = (*matches[1])->lang;
 		/* tags_lang_alt is used to load C global tags only once for C and C++
 		 * lang = 1 is C++, lang = 0 is C



--------------
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