[geany/geany] 54a9fd: Get rid of the nested members in TMTag

Jiří Techet git-noreply at xxxxx
Sat Nov 8 18:58:06 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:      54a9fd83ea0c98b6ba34fe7cd75f1e3a73daa0be
             https://github.com/geany/geany/commit/54a9fd83ea0c98b6ba34fe7cd75f1e3a73daa0be

Log Message:
-----------
Get rid of the nested members in TMTag

The only real change is the removal of struct and union in TMTag, the
rest is purely mechanical removal of "atts.entry." everywhere.


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

Modified: src/editor.c
26 lines changed, 13 insertions(+), 13 deletions(-)
===================================================================
@@ -639,7 +639,7 @@ static void show_tags_list(GeanyEditor *editor, const GPtrArray *tags, gsize roo
 			g_string_append(words, tag->name);
 
 			/* for now, tag types don't all follow C, so just look at arglist */
-			if (!EMPTY(tag->atts.entry.arglist))
+			if (!EMPTY(tag->arglist))
 				g_string_append(words, "?2");
 			else
 				g_string_append(words, "?1");
@@ -732,7 +732,7 @@ static void autocomplete_scope(GeanyEditor *editor)
 		return;
 
 	tag = g_ptr_array_index(tags, 0);
-	name = tag->atts.entry.var_type;
+	name = tag->var_type;
 	if (name)
 	{
 		TMSourceFile *obj = editor->document->tm_file;
@@ -1784,43 +1784,43 @@ static gint find_start_bracket(ScintillaObject *sci, gint pos)
 
 static gboolean append_calltip(GString *str, const TMTag *tag, filetype_id ft_id)
 {
-	if (! tag->atts.entry.arglist)
+	if (! tag->arglist)
 		return FALSE;
 
 	if (ft_id != GEANY_FILETYPES_PASCAL)
 	{	/* usual calltips: "retval tagname (arglist)" */
-		if (tag->atts.entry.var_type)
+		if (tag->var_type)
 		{
 			guint i;
 
-			g_string_append(str, tag->atts.entry.var_type);
-			for (i = 0; i < tag->atts.entry.pointerOrder; i++)
+			g_string_append(str, tag->var_type);
+			for (i = 0; i < tag->pointerOrder; i++)
 			{
 				g_string_append_c(str, '*');
 			}
 			g_string_append_c(str, ' ');
 		}
-		if (tag->atts.entry.scope)
+		if (tag->scope)
 		{
 			const gchar *cosep = symbols_get_context_separator(ft_id);
 
-			g_string_append(str, tag->atts.entry.scope);
+			g_string_append(str, tag->scope);
 			g_string_append(str, cosep);
 		}
 		g_string_append(str, tag->name);
 		g_string_append_c(str, ' ');
-		g_string_append(str, tag->atts.entry.arglist);
+		g_string_append(str, tag->arglist);
 	}
 	else
 	{	/* special case Pascal calltips: "tagname (arglist) : retval" */
 		g_string_append(str, tag->name);
 		g_string_append_c(str, ' ');
-		g_string_append(str, tag->atts.entry.arglist);
+		g_string_append(str, tag->arglist);
 
-		if (!EMPTY(tag->atts.entry.var_type))
+		if (!EMPTY(tag->var_type))
 		{
 			g_string_append(str, " : ");
-			g_string_append(str, tag->atts.entry.var_type);
+			g_string_append(str, tag->var_type);
 		}
 	}
 
@@ -1862,7 +1862,7 @@ static gchar *find_calltip(const gchar *word, GeanyFiletype *ft)
 	{
 		tag = TM_TAG(tags->pdata[i]);
 
-		if (! tag->atts.entry.arglist)
+		if (! tag->arglist)
 			tags->pdata[i] = NULL;
 	}
 	tm_tags_prune((GPtrArray *) tags);


Modified: src/sidebar.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -904,7 +904,7 @@ static gboolean taglist_go_to_selection(GtkTreeSelection *selection, guint keyva
 		if (! tag)
 			return FALSE;
 
-		line = tag->atts.entry.line;
+		line = tag->line;
 		if (line > 0)
 		{
 			GeanyDocument *doc = document_get_current();


Modified: src/symbols.c
64 lines changed, 32 insertions(+), 32 deletions(-)
===================================================================
@@ -266,10 +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 the line of the tag if tag->atts.entry.file 
+			/* 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->atts.entry.lang */
-			tag_lang = (tag->atts.entry.file) ? tag->atts.entry.file->lang : tag->atts.entry.lang;
+			 * information in tag->lang */
+			tag_lang = (tag->file) ? tag->file->lang : tag->lang;
 
 			/* the check for tag_lang == lang is necessary to avoid wrong type colouring of
 			 * e.g. PHP classes in C++ files
@@ -351,8 +351,8 @@ GString *symbols_get_macro_list(gint lang)
 			for (i = 0; ((i < tags->len) && (i < editor_prefs.autocompletion_max_entries)); ++i)
 			{
 				tag = TM_TAG(tags->pdata[i]);
-				tag_lang = (tag->atts.entry.file) ?
-					tag->atts.entry.file->lang : tag->atts.entry.lang;
+				tag_lang = (tag->file) ?
+					tag->file->lang : tag->lang;
 
 				if (tag_lang == lang)
 					g_ptr_array_add(ftags, (gpointer) tags->pdata[i]);
@@ -466,7 +466,7 @@ static gint compare_symbol(const TMTag *tag_a, const TMTag *tag_b)
 	ret = strcmp(tag_a->name, tag_b->name);
 	if (ret == 0)
 	{
-		return tag_a->atts.entry.line - tag_b->atts.entry.line;
+		return tag_a->line - tag_b->line;
 	}
 	return ret;
 }
@@ -482,15 +482,15 @@ static gint compare_symbol_lines(gconstpointer a, gconstpointer b)
 	if (a == NULL || b == NULL)
 		return 0;
 
-	ret = tag_a->atts.entry.line - tag_b->atts.entry.line;
+	ret = tag_a->line - tag_b->line;
 	if (ret == 0)
 	{
-		if (tag_a->atts.entry.scope == NULL)
-			return -(tag_a->atts.entry.scope != tag_b->atts.entry.scope);
-		if (tag_b->atts.entry.scope == NULL)
-			return tag_a->atts.entry.scope != tag_b->atts.entry.scope;
+		if (tag_a->scope == NULL)
+			return -(tag_a->scope != tag_b->scope);
+		if (tag_b->scope == NULL)
+			return tag_a->scope != tag_b->scope;
 		else
-			return strcmp(tag_a->atts.entry.scope, tag_b->atts.entry.scope);
+			return strcmp(tag_a->scope, tag_b->scope);
 	}
 	return ret;
 }
@@ -1035,7 +1035,7 @@ static void hide_empty_rows(GtkTreeStore *store)
 static const gchar *get_symbol_name(GeanyDocument *doc, const TMTag *tag, gboolean found_parent)
 {
 	gchar *utf8_name;
-	const gchar *scope = tag->atts.entry.scope;
+	const gchar *scope = tag->scope;
 	static GString *buffer = NULL;	/* buffer will be small so we can keep it for reuse */
 	gboolean doc_is_utf8 = FALSE;
 
@@ -1076,7 +1076,7 @@ static const gchar *get_symbol_name(GeanyDocument *doc, const TMTag *tag, gboole
 	if (! doc_is_utf8)
 		g_free(utf8_name);
 
-	g_string_append_printf(buffer, " [%lu]", tag->atts.entry.line);
+	g_string_append_printf(buffer, " [%lu]", tag->line);
 
 	return buffer->str;
 }
@@ -1106,7 +1106,7 @@ static gchar *get_symbol_tooltip(GeanyDocument *doc, const TMTag *tag)
 /* find the last word in "foo::bar::blah", e.g. "blah" */
 static const gchar *get_parent_name(const TMTag *tag, filetype_id ft_id)
 {
-	const gchar *scope = tag->atts.entry.scope;
+	const gchar *scope = tag->scope;
 	const gchar *separator = symbols_get_context_separator(ft_id);
 	const gchar *str, *ptr;
 
@@ -1224,9 +1224,9 @@ static gboolean tag_equal(gconstpointer v1, gconstpointer v2)
 	const TMTag *t2 = v2;
 
 	return (t1->type == t2->type && strcmp(t1->name, t2->name) == 0 &&
-			utils_str_equal(t1->atts.entry.scope, t2->atts.entry.scope) &&
+			utils_str_equal(t1->scope, t2->scope) &&
 			/* include arglist in match to support e.g. C++ overloading */
-			utils_str_equal(t1->atts.entry.arglist, t2->atts.entry.arglist));
+			utils_str_equal(t1->arglist, t2->arglist));
 }
 
 
@@ -1240,15 +1240,15 @@ static guint tag_hash(gconstpointer v)
 	h = (h << 5) + h + tag->type;
 	for (p = tag->name; *p != '\0'; p++)
 		h = (h << 5) + h + *p;
-	if (tag->atts.entry.scope)
+	if (tag->scope)
 	{
-		for (p = tag->atts.entry.scope; *p != '\0'; p++)
+		for (p = tag->scope; *p != '\0'; p++)
 			h = (h << 5) + h + *p;
 	}
 	/* for e.g. C++ overloading */
-	if (tag->atts.entry.arglist)
+	if (tag->arglist)
 	{
-		for (p = tag->atts.entry.arglist; *p != '\0'; p++)
+		for (p = tag->arglist; *p != '\0'; p++)
 			h = (h << 5) + h + *p;
 	}
 
@@ -1346,7 +1346,7 @@ static GList *tags_table_lookup(GHashTable *table, TMTag *tag)
 		glong delta;
 		data = node->data;
 
-#define TAG_DELTA(a, b) ABS((glong) TM_TAG(a)->atts.entry.line - (glong) TM_TAG(b)->atts.entry.line)
+#define TAG_DELTA(a, b) ABS((glong) TM_TAG(a)->line - (glong) TM_TAG(b)->line)
 
 		delta = TAG_DELTA(((GList *) node->data)->data, tag);
 		for (node = node->next; node; node = node->next)
@@ -1540,7 +1540,7 @@ static void update_tree_tags(GeanyDocument *doc, GList **tags)
 						gtk_tree_model_get(GTK_TREE_MODEL(store), node->data,
 								SYMBOLS_COLUMN_TAG, &parent_tag, -1);
 
-						d = tag->atts.entry.line - parent_tag->atts.entry.line;
+						d = tag->line - parent_tag->line;
 						if (! parent_search || (d >= 0 && d < delta))
 						{
 							delta = d;
@@ -1614,7 +1614,7 @@ static gboolean tag_has_missing_parent(const TMTag *tag, GtkTreeStore *store,
 		GtkTreeIter *iter)
 {
 	/* if the tag has a parent tag, it should be at depth >= 2 */
-	return !EMPTY(tag->atts.entry.scope) &&
+	return !EMPTY(tag->scope) &&
 		gtk_tree_store_iter_depth(store, iter) == 1;
 }
 
@@ -1664,7 +1664,7 @@ static gint tree_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
 				if (tag_a && tag_b)
 					if (!sort_by_name ||
 						(utils_str_equal(tag_a->name, tag_b->name) &&
-							utils_str_equal(tag_a->atts.entry.scope, tag_b->atts.entry.scope)))
+							utils_str_equal(tag_a->scope, tag_b->scope)))
 						cmp = compare_symbol_lines(tag_a, tag_b);
 			}
 		}
@@ -1948,13 +1948,13 @@ static gboolean goto_tag(const gchar *name, gboolean definition)
 	if (tmtag != NULL)
 	{
 		GeanyDocument *new_doc = document_find_by_real_path(
-			tmtag->atts.entry.file->file_name);
+			tmtag->file->file_name);
 
 		if (new_doc)
 		{
 			/* If we are already on the tag line, swap definition/declaration */
 			if (new_doc == old_doc &&
-				tmtag->atts.entry.line == (guint)sci_get_current_line(old_doc->editor->sci) + 1)
+				tmtag->line == (guint)sci_get_current_line(old_doc->editor->sci) + 1)
 			{
 				if (goto_tag(name, !definition))
 					return TRUE;
@@ -1963,10 +1963,10 @@ static gboolean goto_tag(const gchar *name, gboolean definition)
 		else
 		{
 			/* not found in opened document, should open */
-			new_doc = document_open_file(tmtag->atts.entry.file->file_name, FALSE, NULL, NULL);
+			new_doc = document_open_file(tmtag->file->file_name, FALSE, NULL, NULL);
 		}
 
-		if (navqueue_goto_line(old_doc, new_doc, tmtag->atts.entry.line))
+		if (navqueue_goto_line(old_doc, new_doc, tmtag->line))
 			return TRUE;
 	}
 	return FALSE;
@@ -2135,7 +2135,7 @@ static gint get_current_tag_name(GeanyDocument *doc, gchar **tagname, guint tag_
 
 		if (tag)
 		{
-			gint tag_line = tag->atts.entry.line - 1;
+			gint tag_line = tag->line - 1;
 			gint last_child = line + 1;
 
 			/* if it may be a false positive because we're inside a fold level not inside anything
@@ -2150,8 +2150,8 @@ static gint get_current_tag_name(GeanyDocument *doc, gchar **tagname, guint tag_
 
 			if (line <= last_child)
 			{
-				if (tag->atts.entry.scope)
-					*tagname = g_strconcat(tag->atts.entry.scope,
+				if (tag->scope)
+					*tagname = g_strconcat(tag->scope,
 							symbols_get_context_separator(doc->file_type->id), tag->name, NULL);
 				else
 					*tagname = g_strdup(tag->name);


Modified: tagmanager/src/tm_source_file.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -136,8 +136,8 @@ static void tm_source_file_set_tag_arglist(const char *tag_name, const char *arg
 	if (tags != NULL && count == 1)
 	{
 		tag = tags[0];
-		g_free(tag->atts.entry.arglist);
-		tag->atts.entry.arglist = g_strdup(arglist);
+		g_free(tag->arglist);
+		tag->arglist = g_strdup(arglist);
 	}
 }
 


Modified: tagmanager/src/tm_tag.c
160 lines changed, 80 insertions(+), 80 deletions(-)
===================================================================
@@ -233,27 +233,27 @@ static gboolean tm_tag_init(TMTag *tag, TMSourceFile *file, const tagEntryInfo *
 			return FALSE;
 		tag->name = g_strdup(tag_entry->name);
 		tag->type = get_tag_type(tag_entry->kindName);
-		tag->atts.entry.local = tag_entry->isFileScope;
-		tag->atts.entry.pointerOrder = 0;	/* backward compatibility (use var_type instead) */
-		tag->atts.entry.line = tag_entry->lineNumber;
+		tag->local = tag_entry->isFileScope;
+		tag->pointerOrder = 0;	/* backward compatibility (use var_type instead) */
+		tag->line = tag_entry->lineNumber;
 		if (NULL != tag_entry->extensionFields.arglist)
-			tag->atts.entry.arglist = g_strdup(tag_entry->extensionFields.arglist);
+			tag->arglist = g_strdup(tag_entry->extensionFields.arglist);
 		if ((NULL != tag_entry->extensionFields.scope[1]) &&
 			(isalpha(tag_entry->extensionFields.scope[1][0]) ||
 			 tag_entry->extensionFields.scope[1][0] == '_' ||
 			 tag_entry->extensionFields.scope[1][0] == '$'))
-			tag->atts.entry.scope = g_strdup(tag_entry->extensionFields.scope[1]);
+			tag->scope = g_strdup(tag_entry->extensionFields.scope[1]);
 		if (tag_entry->extensionFields.inheritance != NULL)
-			tag->atts.entry.inheritance = g_strdup(tag_entry->extensionFields.inheritance);
+			tag->inheritance = g_strdup(tag_entry->extensionFields.inheritance);
 		if (tag_entry->extensionFields.varType != NULL)
-			tag->atts.entry.var_type = g_strdup(tag_entry->extensionFields.varType);
+			tag->var_type = g_strdup(tag_entry->extensionFields.varType);
 		if (tag_entry->extensionFields.access != NULL)
-			tag->atts.entry.access = get_tag_access(tag_entry->extensionFields.access);
+			tag->access = get_tag_access(tag_entry->extensionFields.access);
 		if (tag_entry->extensionFields.implementation != NULL)
-			tag->atts.entry.impl = get_tag_impl(tag_entry->extensionFields.implementation);
-		if ((tm_tag_macro_t == tag->type) && (NULL != tag->atts.entry.arglist))
+			tag->impl = get_tag_impl(tag_entry->extensionFields.implementation);
+		if ((tm_tag_macro_t == tag->type) && (NULL != tag->arglist))
 			tag->type = tm_tag_macro_with_arg_t;
-		tag->atts.entry.file = file;
+		tag->file = file;
 		return TRUE;
 	}
 }
@@ -316,28 +316,28 @@ static gboolean tm_tag_init_from_file(TMTag *tag, TMSourceFile *file, FILE *fp)
 			switch (*start)
 			{
 				case TA_LINE:
-					tag->atts.entry.line = atol((gchar*)start + 1);
+					tag->line = atol((gchar*)start + 1);
 					break;
 				case TA_LOCAL:
-					tag->atts.entry.local = atoi((gchar*)start + 1);
+					tag->local = atoi((gchar*)start + 1);
 					break;
 				case TA_TYPE:
 					tag->type = (TMTagType) atoi((gchar*)start + 1);
 					break;
 				case TA_ARGLIST:
-					tag->atts.entry.arglist = g_strdup((gchar*)start + 1);
+					tag->arglist = g_strdup((gchar*)start + 1);
 					break;
 				case TA_SCOPE:
-					tag->atts.entry.scope = g_strdup((gchar*)start + 1);
+					tag->scope = g_strdup((gchar*)start + 1);
 					break;
 				case TA_POINTER:
-					tag->atts.entry.pointerOrder = atoi((gchar*)start + 1);
+					tag->pointerOrder = atoi((gchar*)start + 1);
 					break;
 				case TA_VARTYPE:
-					tag->atts.entry.var_type = g_strdup((gchar*)start + 1);
+					tag->var_type = g_strdup((gchar*)start + 1);
 					break;
 				case TA_INHERITS:
-					tag->atts.entry.inheritance = g_strdup((gchar*)start + 1);
+					tag->inheritance = g_strdup((gchar*)start + 1);
 					break;
 				case TA_TIME:  /* Obsolete */
 					break;
@@ -346,10 +346,10 @@ static gboolean tm_tag_init_from_file(TMTag *tag, TMSourceFile *file, FILE *fp)
 				case TA_INACTIVE:  /* Obsolete */
 					break;
 				case TA_ACCESS:
-					tag->atts.entry.access = *(start + 1);
+					tag->access = *(start + 1);
 					break;
 				case TA_IMPL:
-					tag->atts.entry.impl = *(start + 1);
+					tag->impl = *(start + 1);
 					break;
 				default:
 #ifdef GEANY_DEBUG
@@ -362,7 +362,7 @@ static gboolean tm_tag_init_from_file(TMTag *tag, TMSourceFile *file, FILE *fp)
 	}
 	if (NULL == tag->name)
 		return FALSE;
-	tag->atts.entry.file = file;
+	tag->file = file;
 	return TRUE;
 }
 
@@ -397,8 +397,8 @@ static gboolean tm_tag_init_from_file_alt(TMTag *tag, TMSourceFile *file, FILE *
 
 			if (field_len >= 1) tag->name = g_strdup(fields[0]);
 			else tag->name = NULL;
-			if (field_len >= 2 && fields[1] != NULL) tag->atts.entry.var_type = g_strdup(fields[1]);
-			if (field_len >= 3 && fields[2] != NULL) tag->atts.entry.arglist = g_strdup(fields[2]);
+			if (field_len >= 2 && fields[1] != NULL) tag->var_type = g_strdup(fields[1]);
+			if (field_len >= 3 && fields[2] != NULL) tag->arglist = g_strdup(fields[2]);
 			tag->type = tm_tag_prototype_t;
 			g_strfreev(fields);
 		}
@@ -406,7 +406,7 @@ static gboolean tm_tag_init_from_file_alt(TMTag *tag, TMSourceFile *file, FILE *
 
 	if (NULL == tag->name)
 		return FALSE;
-	tag->atts.entry.file = file;
+	tag->file = file;
 	return TRUE;
 }
 
@@ -455,7 +455,7 @@ static gboolean tm_tag_init_from_file_ctags(TMTag *tag, TMSourceFile *file, FILE
 		}
 	}
 	else /* assume a line */
-		tag->atts.entry.line = atol(p);
+		tag->line = atol(p);
 	tab = strstr(p, ";\"");
 	/* read extension fields */
 	if (tab)
@@ -522,35 +522,35 @@ static gboolean tm_tag_init_from_file_ctags(TMTag *tag, TMSourceFile *file, FILE
 			}
 			else if (0 == strcmp(key, "inherits")) /* comma-separated list of classes this class inherits from */
 			{
-				g_free(tag->atts.entry.inheritance);
-				tag->atts.entry.inheritance = g_strdup(value);
+				g_free(tag->inheritance);
+				tag->inheritance = g_strdup(value);
 			}
 			else if (0 == strcmp(key, "implementation")) /* implementation limit */
-				tag->atts.entry.impl = get_tag_impl(value);
+				tag->impl = get_tag_impl(value);
 			else if (0 == strcmp(key, "line")) /* line */
-				tag->atts.entry.line = atol(value);
+				tag->line = atol(value);
 			else if (0 == strcmp(key, "access")) /* access */
-				tag->atts.entry.access = get_tag_access(value);
+				tag->access = get_tag_access(value);
 			else if (0 == strcmp(key, "class") ||
 					 0 == strcmp(key, "enum") ||
 					 0 == strcmp(key, "function") ||
 					 0 == strcmp(key, "struct") ||
 					 0 == strcmp(key, "union")) /* Name of the class/enum/function/struct/union in which this tag is a member */
 			{
-				g_free(tag->atts.entry.scope);
-				tag->atts.entry.scope = g_strdup(value);
+				g_free(tag->scope);
+				tag->scope = g_strdup(value);
 			}
 			else if (0 == strcmp(key, "file")) /* static (local) tag */
-				tag->atts.entry.local = TRUE;
+				tag->local = TRUE;
 			else if (0 == strcmp(key, "signature")) /* arglist */
 			{
-				g_free(tag->atts.entry.arglist);
-				tag->atts.entry.arglist = g_strdup(value);
+				g_free(tag->arglist);
+				tag->arglist = g_strdup(value);
 			}
 		}
 	}
 
-	tag->atts.entry.file = file;
+	tag->file = file;
 	return TRUE;
 }
 
@@ -583,7 +583,7 @@ TMTag *tm_tag_new_from_file(TMSourceFile *file, FILE *fp, gint mode, TMFileForma
 		TAG_FREE(tag);
 		return NULL;
 	}
-	tag->atts.entry.lang = mode;
+	tag->lang = mode;
 	return tag;
 }
 
@@ -599,24 +599,24 @@ gboolean tm_tag_write(TMTag *tag, FILE *fp, guint attrs)
 	fprintf(fp, "%s", tag->name);
 	if (attrs & tm_tag_attr_type_t)
 		fprintf(fp, "%c%d", TA_TYPE, tag->type);
-	if ((attrs & tm_tag_attr_arglist_t) && (NULL != tag->atts.entry.arglist))
-		fprintf(fp, "%c%s", TA_ARGLIST, tag->atts.entry.arglist);
+	if ((attrs & tm_tag_attr_arglist_t) && (NULL != tag->arglist))
+		fprintf(fp, "%c%s", TA_ARGLIST, tag->arglist);
 	if (attrs & tm_tag_attr_line_t)
-		fprintf(fp, "%c%ld", TA_LINE, tag->atts.entry.line);
+		fprintf(fp, "%c%ld", TA_LINE, tag->line);
 	if (attrs & tm_tag_attr_local_t)
-		fprintf(fp, "%c%d", TA_LOCAL, tag->atts.entry.local);
-	if ((attrs & tm_tag_attr_scope_t) && (NULL != tag->atts.entry.scope))
-		fprintf(fp, "%c%s", TA_SCOPE, tag->atts.entry.scope);
-	if ((attrs & tm_tag_attr_inheritance_t) && (NULL != tag->atts.entry.inheritance))
-		fprintf(fp, "%c%s", TA_INHERITS, tag->atts.entry.inheritance);
+		fprintf(fp, "%c%d", TA_LOCAL, tag->local);
+	if ((attrs & tm_tag_attr_scope_t) && (NULL != tag->scope))
+		fprintf(fp, "%c%s", TA_SCOPE, tag->scope);
+	if ((attrs & tm_tag_attr_inheritance_t) && (NULL != tag->inheritance))
+		fprintf(fp, "%c%s", TA_INHERITS, tag->inheritance);
 	if (attrs & tm_tag_attr_pointer_t)
-		fprintf(fp, "%c%d", TA_POINTER, tag->atts.entry.pointerOrder);
-	if ((attrs & tm_tag_attr_vartype_t) && (NULL != tag->atts.entry.var_type))
-		fprintf(fp, "%c%s", TA_VARTYPE, tag->atts.entry.var_type);
-	if ((attrs & tm_tag_attr_access_t) && (TAG_ACCESS_UNKNOWN != tag->atts.entry.access))
-		fprintf(fp, "%c%c", TA_ACCESS, tag->atts.entry.access);
-	if ((attrs & tm_tag_attr_impl_t) && (TAG_IMPL_UNKNOWN != tag->atts.entry.impl))
-		fprintf(fp, "%c%c", TA_IMPL, tag->atts.entry.impl);
+		fprintf(fp, "%c%d", TA_POINTER, tag->pointerOrder);
+	if ((attrs & tm_tag_attr_vartype_t) && (NULL != tag->var_type))
+		fprintf(fp, "%c%s", TA_VARTYPE, tag->var_type);
+	if ((attrs & tm_tag_attr_access_t) && (TAG_ACCESS_UNKNOWN != tag->access))
+		fprintf(fp, "%c%c", TA_ACCESS, tag->access);
+	if ((attrs & tm_tag_attr_impl_t) && (TAG_IMPL_UNKNOWN != tag->impl))
+		fprintf(fp, "%c%c", TA_IMPL, tag->impl);
 
 	if (fprintf(fp, "\n"))
 		return TRUE;
@@ -632,10 +632,10 @@ gboolean tm_tag_write(TMTag *tag, FILE *fp, guint attrs)
 static void tm_tag_destroy(TMTag *tag)
 {
 	g_free(tag->name);
-	g_free(tag->atts.entry.arglist);
-	g_free(tag->atts.entry.scope);
-	g_free(tag->atts.entry.inheritance);
-	g_free(tag->atts.entry.var_type);
+	g_free(tag->arglist);
+	g_free(tag->scope);
+	g_free(tag->inheritance);
+	g_free(tag->var_type);
 }
 
 
@@ -708,27 +708,27 @@ static int tm_tag_compare(const void *ptr1, const void *ptr2)
 					return returnval;
 				break;
 			case tm_tag_attr_file_t:
-				if (0 != (returnval = (t1->atts.entry.file - t2->atts.entry.file)))
+				if (0 != (returnval = (t1->file - t2->file)))
 					return returnval;
 				break;
 			case tm_tag_attr_scope_t:
-				if (0 != (returnval = strcmp(FALLBACK(t1->atts.entry.scope, ""), FALLBACK(t2->atts.entry.scope, ""))))
+				if (0 != (returnval = strcmp(FALLBACK(t1->scope, ""), FALLBACK(t2->scope, ""))))
 					return returnval;
 				break;
 			case tm_tag_attr_arglist_t:
-				if (0 != (returnval = strcmp(FALLBACK(t1->atts.entry.arglist, ""), FALLBACK(t2->atts.entry.arglist, ""))))
+				if (0 != (returnval = strcmp(FALLBACK(t1->arglist, ""), FALLBACK(t2->arglist, ""))))
 				{
-					int line_diff = (t1->atts.entry.line - t2->atts.entry.line);
+					int line_diff = (t1->line - t2->line);
 
 					return line_diff ? line_diff : returnval;
 				}
 				break;
 			case tm_tag_attr_vartype_t:
-				if (0 != (returnval = strcmp(FALLBACK(t1->atts.entry.var_type, ""), FALLBACK(t2->atts.entry.var_type, ""))))
+				if (0 != (returnval = strcmp(FALLBACK(t1->var_type, ""), FALLBACK(t2->var_type, ""))))
 					return returnval;
 				break;
 			case tm_tag_attr_line_t:
-				if (0 != (returnval = (t1->atts.entry.line - t2->atts.entry.line)))
+				if (0 != (returnval = (t1->line - t2->line)))
 					return returnval;
 				break;
 		}
@@ -809,7 +809,7 @@ GPtrArray *tm_tags_remove_file_tags(TMSourceFile *source_file, GPtrArray *tags_a
 	{
 		TMTag *tag = tags_array->pdata[i];
 		
-		if (tag != NULL && tag->atts.entry.file == source_file)
+		if (tag != NULL && tag->file == source_file)
 			tags_array->pdata[i] = NULL;
 	}
 	tm_tags_prune(tags_array);
@@ -1121,7 +1121,7 @@ TMTagType tm_tag_name_type(const char* tag_name)
 static const char *tm_tag_impl_name(TMTag *tag)
 {
 	g_return_val_if_fail(tag, NULL);
-	if (TAG_IMPL_VIRTUAL == tag->atts.entry.impl)
+	if (TAG_IMPL_VIRTUAL == tag->impl)
 		return "virtual";
 	else
 		return NULL;
@@ -1130,11 +1130,11 @@ static const char *tm_tag_impl_name(TMTag *tag)
 static const char *tm_tag_access_name(TMTag *tag)
 {
 	g_return_val_if_fail(tag, NULL);
-	if (TAG_ACCESS_PUBLIC == tag->atts.entry.access)
+	if (TAG_ACCESS_PUBLIC == tag->access)
 		return "public";
-	else if (TAG_ACCESS_PROTECTED == tag->atts.entry.access)
+	else if (TAG_ACCESS_PROTECTED == tag->access)
 		return "protected";
-	else if (TAG_ACCESS_PRIVATE == tag->atts.entry.access)
+	else if (TAG_ACCESS_PRIVATE == tag->access)
 		return "private";
 	else
 		return NULL;
@@ -1159,18 +1159,18 @@ void tm_tag_print(TMTag *tag, FILE *fp)
 		fprintf(fp, "%s ", impl);
 	if (type)
 		fprintf(fp, "%s ", type);
-	if (tag->atts.entry.var_type)
-		fprintf(fp, "%s ", tag->atts.entry.var_type);
-	if (tag->atts.entry.scope)
-		fprintf(fp, "%s::", tag->atts.entry.scope);
+	if (tag->var_type)
+		fprintf(fp, "%s ", tag->var_type);
+	if (tag->scope)
+		fprintf(fp, "%s::", tag->scope);
 	fprintf(fp, "%s", tag->name);
-	if (tag->atts.entry.arglist)
-		fprintf(fp, "%s", tag->atts.entry.arglist);
-	if (tag->atts.entry.inheritance)
-		fprintf(fp, " : from %s", tag->atts.entry.inheritance);
-	if ((tag->atts.entry.file) && (tag->atts.entry.line > 0))
-		fprintf(fp, "[%s:%ld]", tag->atts.entry.file->file_name
-		  , tag->atts.entry.line);
+	if (tag->arglist)
+		fprintf(fp, "%s", tag->arglist);
+	if (tag->inheritance)
+		fprintf(fp, " : from %s", tag->inheritance);
+	if ((tag->file) && (tag->line > 0))
+		fprintf(fp, "[%s:%ld]", tag->file->file_name
+		  , tag->line);
 	fprintf(fp, "\n");
 }
 
@@ -1197,9 +1197,9 @@ gint tm_tag_scope_depth(const TMTag *t)
 {
 	gint depth;
 	char *s;
-	if(!(t && t->atts.entry.scope))
+	if(!(t && t->scope))
 		return 0;
-	for (s = t->atts.entry.scope, depth = 0; s; s = strstr(s, "::"))
+	for (s = t->scope, depth = 0; s; s = strstr(s, "::"))
 	{
 		++ depth;
 		++ s;


Modified: tagmanager/src/tm_tag.h
36 lines changed, 16 insertions(+), 20 deletions(-)
===================================================================
@@ -124,26 +124,22 @@ typedef struct _TMTag
 {
 	char *name; /**< Name of tag */
 	TMTagType type; /**< Tag Type */
-	union
-	{
-		/** These are *real* tag attributes */
-		struct
-		{
-			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;
-			char *arglist; /**< Argument list (functions/prototypes/macros) */
-			char *scope; /**< Scope of tag */
-			char *inheritance; /**< Parent classes */
-			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;
-	} atts;
+	
+	/** These are tag attributes */
+	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;
+	char *arglist; /**< Argument list (functions/prototypes/macros) */
+	char *scope; /**< Scope of tag */
+	char *inheritance; /**< Parent classes */
+	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 */
+
 	gint refcount; /**< the reference count of the tag */
 } TMTag;
 


Modified: tagmanager/src/tm_workspace.c
108 lines changed, 54 insertions(+), 54 deletions(-)
===================================================================
@@ -612,8 +612,8 @@ const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *at
 	if (matches[0] && *matches[0])
 	{
 		/* tag->atts.file.lang contains the line of the tag and
-		 * tags->atts.entry.file->lang contains the language */
-		tags_lang = (*matches[0])->atts.entry.file->lang;
+		 * tags->file->lang contains the language */
+		tags_lang = (*matches[0])->file->lang;
 
 		for (tagIter=0;tagIter<tagCount[0];++tagIter)
 		{
@@ -638,8 +638,8 @@ 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.entry.lang;
+		 * 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
 		 * if we have lang 0, than accept also lang 1 for C++ */
@@ -675,14 +675,14 @@ const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *at
 
 static gboolean match_langs(gint lang, const TMTag *tag)
 {
-	if (tag->atts.entry.file)
+	if (tag->file)
 	{	/* workspace tag */
-		if (lang == tag->atts.entry.file->lang)
+		if (lang == tag->file->lang)
 			return TRUE;
 	}
 	else
 	{	/* global tag */
-		if (lang == tag->atts.entry.lang)
+		if (lang == tag->lang)
 			return TRUE;
 	}
 	return FALSE;
@@ -706,8 +706,8 @@ fill_find_tags_array (GPtrArray *dst, const GPtrArray *src,
 	{
 		for (tagIter = 0; tagIter < count; ++tagIter)
 		{
-			if (! scope || (match[tagIter]->atts.entry.scope &&
-				0 == strcmp(match[tagIter]->atts.entry.scope, scope)))
+			if (! scope || (match[tagIter]->scope &&
+				0 == strcmp(match[tagIter]->scope, scope)))
 			{
 				if (type & match[tagIter]->type)
 				if (lang == -1 || match_langs(lang, match[tagIter]))
@@ -779,10 +779,10 @@ tm_get_current_tag (GPtrArray * file_tags, const gulong line, const guint tag_ty
 		{
 			TMTag *tag = TM_TAG (file_tags->pdata[i]);
 			if (tag && tag->type & tag_types &&
-				tag->atts.entry.line <= line && tag->atts.entry.line > matching_line)
+				tag->line <= line && tag->line > matching_line)
 			{
 				matching_tag = tag;
-				matching_line = tag->atts.entry.line;
+				matching_line = tag->line;
 			}
 		}
 	}
@@ -802,15 +802,15 @@ find_scope_members_tags (const GPtrArray * all, GPtrArray * tags,
 	for (i = 0; (i < all->len); ++i)
 	{
 		tag = TM_TAG (all->pdata[i]);
-		if (no_definitions && filename && tag->atts.entry.file &&
+		if (no_definitions && filename && tag->file &&
 			0 != strcmp (filename,
-						 tag->atts.entry.file->short_name))
+						 tag->file->short_name))
 		{
 			continue;
 		}
-		if (tag && tag->atts.entry.scope && tag->atts.entry.scope[0] != '\0')
+		if (tag && tag->scope && tag->scope[0] != '\0')
 		{
-			if (0 == strncmp (name, tag->atts.entry.scope, len))
+			if (0 == strncmp (name, tag->scope, len))
 			{
 				g_ptr_array_add (local, tag);
 			}
@@ -827,7 +827,7 @@ find_scope_members_tags (const GPtrArray * all, GPtrArray * tags,
 		for (i = 0; (i < local->len); ++i)
 		{
 			tag = TM_TAG (local->pdata[i]);
-			scope = tag->atts.entry.scope;
+			scope = tag->scope;
 			if (scope && 0 == strcmp (name, scope))
 			{
 				g_ptr_array_add (tags, tag);
@@ -841,23 +841,23 @@ find_scope_members_tags (const GPtrArray * all, GPtrArray * tags,
 				{
 					backup = s_backup[0];
 					s_backup[0] = '\0';
-					if (0 == strcmp (name, tag->atts.entry.scope))
+					if (0 == strcmp (name, tag->scope))
 					{
 						j = local->len;
 						s_backup[0] = backup;
 						break;
 					}
 				}
-				if (tag->atts.entry.file
-					&& tag->atts.entry.file->lang == langJava)
+				if (tag->file
+					&& tag->file->lang == langJava)
 				{
-					scope = strrchr (tag->atts.entry.scope, '.');
+					scope = strrchr (tag->scope, '.');
 					if (scope)
 						var_type = scope + 1;
 				}
 				else
 				{
-					scope = strrchr (tag->atts.entry.scope, ':');
+					scope = strrchr (tag->scope, ':');
 					if (scope)
 					{
 						var_type = scope + 1;
@@ -880,8 +880,8 @@ find_scope_members_tags (const GPtrArray * all, GPtrArray * tags,
 						if (i == j)
 							continue;
 						tag2 = TM_TAG (local->pdata[j]);
-						if (tag2->atts.entry.var_type &&
-							0 == strcmp (var_type, tag2->atts.entry.var_type))
+						if (tag2->var_type &&
+							0 == strcmp (var_type, tag2->var_type))
 						{
 							break;
 						}
@@ -957,11 +957,11 @@ tm_workspace_find_scope_members (const GPtrArray * file_tags, const char *name,
 
 		if ((tags2) && (tags2->len == 1) && (tag = TM_TAG (tags2->pdata[0])))
 		{
-			if (tag->type == tm_tag_typedef_t && tag->atts.entry.var_type
-				&& tag->atts.entry.var_type[0] != '\0')
+			if (tag->type == tm_tag_typedef_t && tag->var_type
+				&& tag->var_type[0] != '\0')
 			{
 				char *tmp_name;
-				tmp_name = tag->atts.entry.var_type;
+				tmp_name = tag->var_type;
 				if (strcmp(tmp_name, new_name) == 0) {
 					new_name = NULL;
 				}
@@ -970,22 +970,22 @@ tm_workspace_find_scope_members (const GPtrArray * file_tags, const char *name,
 				}
 				continue;
 			}
-			filename = (tag->atts.entry.file ?
-						tag->atts.entry.file->short_name : NULL);
-			if (tag->atts.entry.scope && tag->atts.entry.scope[0] != '\0')
+			filename = (tag->file ?
+						tag->file->short_name : NULL);
+			if (tag->scope && tag->scope[0] != '\0')
 			{
 				del = 1;
-				if (tag->atts.entry.file &&
-					tag->atts.entry.file->lang == langJava)
+				if (tag->file &&
+					tag->file->lang == langJava)
 				{
 					new_name = g_strdup_printf ("%s.%s",
-												tag->atts.entry.scope,
+												tag->scope,
 												new_name);
 				}
 				else
 				{
 					new_name = g_strdup_printf ("%s::%s",
-												tag->atts.entry.scope,
+												tag->scope,
 												new_name);
 				}
 			}
@@ -999,9 +999,9 @@ tm_workspace_find_scope_members (const GPtrArray * file_tags, const char *name,
 
 	g_ptr_array_set_size (tags, 0);
 
-	if (no_definitions && tag && tag->atts.entry.file)
+	if (no_definitions && tag && tag->file)
 	{
-		local = tm_tags_extract (tag->atts.entry.file->tags_array,
+		local = tm_tags_extract (tag->file->tags_array,
 								 (tm_tag_function_t | tm_tag_prototype_t |
 								  tm_tag_member_t | tm_tag_field_t |
 								  tm_tag_method_t | tm_tag_enumerator_t));
@@ -1098,16 +1098,16 @@ find_namespace_members_tags (const GPtrArray * all, GPtrArray * tags,
 	for (i = 0; (i < all->len); ++i)
 	{
 		tag = TM_TAG (all->pdata[i]);
-		if (filename && tag->atts.entry.file &&
+		if (filename && tag->file &&
 			0 != strcmp (filename,
-						 tag->atts.entry.file->short_name))
+						 tag->file->short_name))
 		{
 			continue;
 		}
 
-		if (tag && tag->atts.entry.scope && tag->atts.entry.scope[0] != '\0')
+		if (tag && tag->scope && tag->scope[0] != '\0')
 		{
-			if (0 == strncmp (name, tag->atts.entry.scope, len))
+			if (0 == strncmp (name, tag->scope, len))
 			{
 				g_ptr_array_add (local, tag);
 			}
@@ -1120,7 +1120,7 @@ find_namespace_members_tags (const GPtrArray * all, GPtrArray * tags,
 		for (i = 0; (i < local->len); ++i)
 		{
 			tag = TM_TAG (local->pdata[i]);
-			scope = tag->atts.entry.scope;
+			scope = tag->scope;
 
 			/* if we wanna complete something like
 			 * namespace1::
@@ -1186,28 +1186,28 @@ tm_workspace_find_namespace_members (const GPtrArray * file_tags, const char *na
 
 		if ((tags2) && (tags2->len == 1) && (tag = TM_TAG (tags2->pdata[0])))
 		{
-			if (tag->type == tm_tag_typedef_t && tag->atts.entry.var_type
-				&& tag->atts.entry.var_type[0] != '\0')
+			if (tag->type == tm_tag_typedef_t && tag->var_type
+				&& tag->var_type[0] != '\0')
 			{
-				new_name = tag->atts.entry.var_type;
+				new_name = tag->var_type;
 				continue;
 			}
-			filename = (tag->atts.entry.file ?
-						tag->atts.entry.file->short_name : NULL);
-			if (tag->atts.entry.scope && tag->atts.entry.scope[0] != '\0')
+			filename = (tag->file ?
+						tag->file->short_name : NULL);
+			if (tag->scope && tag->scope[0] != '\0')
 			{
 				del = 1;
-				if (tag->atts.entry.file &&
-					tag->atts.entry.file->lang == langJava)
+				if (tag->file &&
+					tag->file->lang == langJava)
 				{
 					new_name = g_strdup_printf ("%s.%s",
-												tag->atts.entry.scope,
+												tag->scope,
 												new_name);
 				}
 				else
 				{
 					new_name = g_strdup_printf ("%s::%s",
-												tag->atts.entry.scope,
+												tag->scope,
 												new_name);
 				}
 			}
@@ -1221,9 +1221,9 @@ tm_workspace_find_namespace_members (const GPtrArray * file_tags, const char *na
 
 	g_ptr_array_set_size (tags, 0);
 
-	if (tag && tag->atts.entry.file)
+	if (tag && tag->file)
 	{
-		local = tm_tags_extract (tag->atts.entry.file->tags_array,
+		local = tm_tags_extract (tag->file->tags_array,
 								 (tm_tag_function_t |
 								  tm_tag_field_t | tm_tag_enumerator_t |
 								  tm_tag_namespace_t | tm_tag_class_t ));
@@ -1311,9 +1311,9 @@ static const GPtrArray *tm_workspace_get_parents(const gchar *name)
 	while (i < parents->len)
 	{
 		tag = TM_TAG(parents->pdata[i]);
-		if ((NULL != tag->atts.entry.inheritance) && (isalpha(tag->atts.entry.inheritance[0])))
+		if ((NULL != tag->inheritance) && (isalpha(tag->inheritance[0])))
 		{
-			klasses = g_strsplit(tag->atts.entry.inheritance, ",", 10);
+			klasses = g_strsplit(tag->inheritance, ",", 10);
 			for (klass = klasses; (NULL != *klass); ++ klass)
 			{
 				for (j=0; j < parents->len; ++j)



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