Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Wed, 22 Oct 2014 14:58:38 UTC
Commit: a183d9cb97c3adde33e6a7dfd08591d802bc2316
https://github.com/geany/geany/commit/a183d9cb97c3adde33e6a7dfd08591d802bc2…
Log Message:
-----------
Move the refcount TMTag member up in the structure and don't document it for plugins
Modified Paths:
--------------
tagmanager/src/tm_tag.h
Modified: tagmanager/src/tm_tag.h
3 lines changed, 1 insertions(+), 2 deletions(-)
===================================================================
@@ -124,6 +124,7 @@ typedef struct _TMTag
{
char *name; /**< Name of tag */
TMTagType type; /**< Tag Type */
+ gint refcount; /* the reference count of the tag */
/** These are tag attributes */
TMSourceFile *file; /**< File in which the tag occurs; NULL for global tags */
@@ -137,8 +138,6 @@ typedef struct _TMTag
char access; /**< Access type (public/protected/private/etc.) */
char impl; /**< Implementation (e.g. virtual) */
langType lang; /**< Programming language of the file */
-
- gint refcount; /**< the reference count of the tag */
} TMTag;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Sat, 18 Oct 2014 19:40:10 UTC
Commit: 48725e4188764b71b97f4e68291f89a222d91a5d
https://github.com/geany/geany/commit/48725e4188764b71b97f4e68291f89a222d91…
Log Message:
-----------
Get rid of the file struct in TMTag, preparation for the union removal
The union on TMTag is very confusing and rather dangerous. The fields
file/timestamp and line/lang overlap. Some implicit assumptions are made
in the code - timestamp is never set so when file is NULL, the file
struct should be used to get the lang member. Rather avoid using unions
and move the lang member to the entry struct together with the other
attributes.
Modified Paths:
--------------
src/symbols.c
tagmanager/src/tm_tag.c
tagmanager/src/tm_tag.h
tagmanager/src/tm_workspace.c
Modified: src/symbols.c
9 lines changed, 5 insertions(+), 4 deletions(-)
===================================================================
@@ -266,9 +266,10 @@ 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 (for some reason) the line of the tag if
- * tag->atts.entry.file is not NULL */
- tag_lang = (tag->atts.entry.file) ? tag->atts.entry.file->lang : tag->atts.file.lang;
+ /* tag->atts.file.lang contains the line of the tag if tag->atts.entry.file
+ * is not NULL (geany document); otherwise it's a global tag with lang
+ * information in tag->atts.entry.lang */
+ tag_lang = (tag->atts.entry.file) ? tag->atts.entry.file->lang : tag->atts.entry.lang;
/* the check for tag_lang == lang is necessary to avoid wrong type colouring of
* e.g. PHP classes in C++ files
@@ -351,7 +352,7 @@ GString *symbols_get_macro_list(gint lang)
{
tag = TM_TAG(tags->pdata[i]);
tag_lang = (tag->atts.entry.file) ?
- tag->atts.entry.file->lang : tag->atts.file.lang;
+ tag->atts.entry.file->lang : tag->atts.entry.lang;
if (tag_lang == lang)
g_ptr_array_add(ftags, (gpointer) tags->pdata[i]);
Modified: tagmanager/src/tm_tag.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -583,7 +583,7 @@ TMTag *tm_tag_new_from_file(TMSourceFile *file, FILE *fp, gint mode, TMFileForma
TAG_FREE(tag);
return NULL;
}
- tag->atts.file.lang = mode;
+ tag->atts.entry.lang = mode;
return tag;
}
Modified: tagmanager/src/tm_tag.h
11 lines changed, 4 insertions(+), 7 deletions(-)
===================================================================
@@ -129,7 +129,7 @@ typedef struct _TMTag
/** These are *real* tag attributes */
struct
{
- TMSourceFile *file; /**< File in which the tag occurs */
+ TMSourceFile *file; /**< File in which the tag occurs; NULL for global tags */
gulong line; /**< Line number of the tag */
gboolean local; /**< Is the tag of local scope */
guint pointerOrder;
@@ -139,13 +139,10 @@ 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 */
} entry;
- /** These are pseudo tag attributes representing a file */
- struct
- {
- time_t timestamp; /**< Time of parsing of the file */
- langType lang; /**< Programming language of the file */
- } file;
} atts;
gint refcount; /**< the reference count of the tag */
} TMTag;
Modified: tagmanager/src/tm_workspace.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -639,7 +639,7 @@ const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *at
int tags_lang_alt = 0;
/* tag->atts.file.lang contains the language and
* tags->atts.entry.file is NULL */
- tags_lang = (*matches[1])->atts.file.lang;
+ tags_lang = (*matches[1])->atts.entry.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
* if we have lang 0, than accept also lang 1 for C++ */
@@ -682,7 +682,7 @@ static gboolean match_langs(gint lang, const TMTag *tag)
}
else
{ /* global tag */
- if (lang == tag->atts.file.lang)
+ if (lang == tag->atts.entry.lang)
return TRUE;
}
return FALSE;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Sat, 18 Oct 2014 19:40:11 UTC
Commit: 62332e19aa9182593dccea5f21fcd1c34b99f144
https://github.com/geany/geany/commit/62332e19aa9182593dccea5f21fcd1c34b99f…
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).