[geany/geany] 2682d7: Remove anon_* elements when performing namespace search

Jiří Techet git-noreply at xxxxx
Thu Feb 11 14:35:57 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Mon, 18 Jan 2016 21:56:10 UTC
Commit:      2682d7973f0518ccfb3806901170ff8314c311c6
             https://github.com/geany/geany/commit/2682d7973f0518ccfb3806901170ff8314c311c6

Log Message:
-----------
Remove anon_* elements when performing namespace search

These correspond to anonymous structs, enums, etc. but they don't have
any name so the name shouldn't be listed.


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

Modified: tagmanager/src/tm_tag.c
14 lines changed, 14 insertions(+), 0 deletions(-)
===================================================================
@@ -1197,6 +1197,20 @@ const gchar *tm_tag_context_separator(langType lang)
 	}
 }
 
+gboolean tm_tag_is_anon(const TMTag *tag)
+{
+	guint i;
+	char dummy;
+
+	if (tag->lang == TM_PARSER_C || tag->lang == TM_PARSER_CPP)
+		return sscanf(tag->name, "anon_%*[a-z]_%u%c", &i, &dummy) == 1;
+	else if (tag->lang == TM_PARSER_FORTRAN || tag->lang == TM_PARSER_F77)
+		return sscanf(tag->name, "Structure#%u%c", &i, &dummy) == 1 ||
+			sscanf(tag->name, "Interface#%u%c", &i, &dummy) == 1 ||
+			sscanf(tag->name, "Enum#%u%c", &i, &dummy) == 1;
+	return FALSE;
+}
+
 #if 0
 /* Returns TMTag to function or method which "own" given line
  @param line Current line in edited file.


Modified: tagmanager/src/tm_tag.h
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -193,6 +193,8 @@ gboolean tm_tags_equal(const TMTag *a, const TMTag *b);
 
 const gchar *tm_tag_context_separator(langType lang);
 
+gboolean tm_tag_is_anon(const TMTag *tag);
+
 #ifdef TM_DEBUG /* various debugging functions */
 
 const char *tm_tag_type_name(const TMTag *tag);


Modified: tagmanager/src/tm_workspace.c
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -779,7 +779,8 @@ find_scope_members_tags (const GPtrArray *all, TMTag *type_tag, gboolean namespa
 		if (tag && (tag->type & member_types) &&
 			tag->scope && tag->scope[0] != '\0' &&
 			langs_compatible(tag->lang, type_tag->lang) &&
-			strcmp(scope, tag->scope) == 0)
+			strcmp(scope, tag->scope) == 0 &&
+			(!namespace || !tm_tag_is_anon(tag)))
 		{
 			g_ptr_array_add (tags, tag);
 		}



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