Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Thu, 01 Sep 2022 13:03:17 UTC Commit: 45f8ed427a69a0637bbf6efe41892b26288e4efa https://github.com/geany/geany-plugins/commit/45f8ed427a69a0637bbf6efe41892b...
Log Message: ----------- geanygendoc: Remove all sanity checks testing if tag is tm_tag_file_t
tm_tag_file_t has never been used by Geany so the check is unnecessary. In the latest version of Geany this tag was renamed to tm_tag_local_var_t and used for local variables which breaks compilation.
Modified Paths: -------------- geanygendoc/src/ggd-tag-utils.c geanygendoc/src/ggd.c
Modified: geanygendoc/src/ggd-tag-utils.c 66 lines changed, 26 insertions(+), 40 deletions(-) =================================================================== @@ -56,16 +56,12 @@ tag_cmp_by_line (gconstpointer a, gint direction = GPOINTER_TO_INT (data); gint rv;
- if (t1->type & tm_tag_file_t || t2->type & tm_tag_file_t) { - rv = 0; + if (t1->line > t2->line) { + rv = +direction; + } else if (t1->line < t2->line) { + rv = -direction; } else { - if (t1->line > t2->line) { - rv = +direction; - } else if (t1->line < t2->line) { - rv = -direction; - } else { - rv = 0; - } + rv = 0; }
return rv; @@ -158,11 +154,9 @@ ggd_tag_find_from_line (const GPtrArray *tags, g_return_val_if_fail (tags != NULL, NULL);
GGD_PTR_ARRAY_FOR (tags, i, el) { - if (! (el->type & tm_tag_file_t)) { - if (el->line <= line && - (! tag || el->line > tag->line)) { - tag = el; - } + if (el->line <= line && + (! tag || el->line > tag->line)) { + tag = el; } }
@@ -239,8 +233,7 @@ ggd_tag_find_parent (const GPtrArray *tags, /*g_debug ("%s: parent_name = %s", G_STRFUNC, parent_name); g_debug ("%s: parent_scope = %s", G_STRFUNC, parent_scope);*/ GGD_PTR_ARRAY_FOR (tags, i, el) { - if (! (el->type & tm_tag_file_t) && - (utils_str_equal (el->name, parent_name) && + if ((utils_str_equal (el->name, parent_name) && utils_str_equal (el->scope, parent_scope) && el->line <= child->line)) { tag = el; @@ -273,8 +266,7 @@ static const struct { { tm_tag_variable_t, "variable" }, { tm_tag_externvar_t, "extern" }, { tm_tag_macro_t, "define" }, - { tm_tag_macro_with_arg_t, "macro" }, - { tm_tag_file_t, "file" } + { tm_tag_macro_with_arg_t, "macro" } };
/** @@ -361,32 +353,27 @@ ggd_tag_resolve_type_hierarchy (const GPtrArray *tags, GeanyFiletypeID geany_ft, const TMTag *tag) { + TMTag *parent_tag; gchar *scope = NULL;
g_return_val_if_fail (tags != NULL, NULL); g_return_val_if_fail (tag != NULL, NULL); - - if (tag->type & tm_tag_file_t) { - g_critical (_("Invalid tag")); - } else { - TMTag *parent_tag;
- parent_tag = ggd_tag_find_parent (tags, geany_ft, tag); - scope = g_strdup (ggd_tag_get_type_name (tag)); - if (parent_tag) { - gchar *parent_scope; + parent_tag = ggd_tag_find_parent (tags, geany_ft, tag); + scope = g_strdup (ggd_tag_get_type_name (tag)); + if (parent_tag) { + gchar *parent_scope; + + parent_scope = ggd_tag_resolve_type_hierarchy (tags, geany_ft, parent_tag); + if (! parent_scope) { + /*g_debug ("no parent scope");*/ + } else { + gchar *tmp;
- parent_scope = ggd_tag_resolve_type_hierarchy (tags, geany_ft, parent_tag); - if (! parent_scope) { - /*g_debug ("no parent scope");*/ - } else { - gchar *tmp; - - tmp = g_strconcat (parent_scope, ".", scope, NULL); - g_free (scope); - scope = tmp; - g_free (parent_scope); - } + tmp = g_strconcat (parent_scope, ".", scope, NULL); + g_free (scope); + scope = tmp; + g_free (parent_scope); } }
@@ -414,8 +401,7 @@ ggd_tag_find_from_name (const GPtrArray *tags, g_return_val_if_fail (name != NULL, NULL);
GGD_PTR_ARRAY_FOR (tags, i, el) { - if (! (el->type & tm_tag_file_t) && - utils_str_equal (el->name, name)) { + if (utils_str_equal (el->name, name)) { tag = el; break; }
Modified: geanygendoc/src/ggd.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -529,7 +529,7 @@ ggd_insert_comment (GeanyDocument *doc, tag_array = doc->tm_file->tags_array; tag = ggd_tag_find_from_line (tag_array, line + 1 /* it is a SCI line */); } - if (! tag || (tag->type & tm_tag_file_t)) { + if (! tag) { msgwin_status_add (_("No valid tag at line %d."), line); } else { if (get_config (doc, doc_type, &filetype, &doctype)) {
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org