Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Thu, 20 Feb 2014 14:26:46 UTC Commit: 19118407ac98893f9c1a123cd6035be0837dd073 https://github.com/geany/geany-plugins/commit/19118407ac98893f9c1a123cd6035b...
Log Message: ----------- geanygendoc: Remove some dead code
Modified Paths: -------------- geanygendoc/src/ggd-tag-utils.c geanygendoc/src/ggd-tag-utils.h geanygendoc/src/ggd.c
Modified: geanygendoc/src/ggd-tag-utils.c 88 files changed, 2 insertions(+), 86 deletions(-) =================================================================== @@ -424,69 +424,11 @@ return tag; }
- -/* - * scope_child_matches: - * @a: parent scope - * @b: child scope - * @geany_ft: The Geany's file type identifier for which tags were generated - * @maxdepth: maximum sub-child level that matches, or < 0 for all to match - * - * Checks if scope @b is inside scope @a. @maxdepth make possible to only match - * child scope if it have less than @maxdepth parents before scope @a. - * E.g., with a maximum depth of 1, only direct children will match. - * - * Returns: %TRUE if matches, %FALSE otherwise. - */ -static gboolean -scope_child_matches (const gchar *a, - const gchar *b, - filetype_id geany_ft, - gint maxdepth) -{ - gboolean matches = FALSE; - - /*g_debug ("trying to match %s against %s", b, a);*/ - if (a && b) { - for (; *a && *b && *a == *b; a++, b++); - if (! *a /* we're at the end of the prefix and it matched */) { - const gchar *separator; - - separator = symbols_get_context_separator (geany_ft); - if (maxdepth < 0) { - if (! *b || strncmp (b, separator, strlen (separator)) == 0) { - matches = TRUE; - } - } else { - while (! matches && maxdepth >= 0) { - const gchar *tmp; - - tmp = strstr (b, separator); - if (tmp) { - b = &tmp[2]; - maxdepth --; - } else { - if (! *b) { - matches = TRUE; - } - break; - } - } - } - } - } - - return matches; -} - - /** * ggd_tag_find_children: * @tags: Array of tags that contains @parent * @parent: Tag for which get children * @geany_ft: The Geany's file type identifier for which tags were generated - * @depth: Maximum depth for children to be found (< 0 means infinite) - * Value != 0 aren't honored for now, see FIXME in function's body. * @filter: A logical OR of the TMTagType<!-- -->s to match * * Finds children tags of a #TMTag that matches @matches. @@ -499,46 +441,23 @@ ggd_tag_find_children_filtered (const GPtrArray *tags, const TMTag *parent, filetype_id geany_ft, - gint depth, TMTagType filter) { GList *children = NULL; guint i; TMTag *el; - /*gchar *fake_scope;*/
g_return_val_if_fail (tags != NULL, NULL); g_return_val_if_fail (parent != NULL, NULL);
- /*if (parent->atts.entry.scope) { - fake_scope = g_strconcat (parent->atts.entry.scope, - symbols_get_context_separator (geany_ft), - parent->name, NULL); - } else { - fake_scope = g_strdup (parent->name); - }*/ GGD_PTR_ARRAY_FOR (tags, i, el) { - /* FIXME: we definitely need a better way to determinate who is child of - * who and who is parent of who. - * On this side, it may find as children a tag that isn't the children, - * and simply getting children that comes after parent isn't a proper fix - * since the first possible parent will have all children. - * Crap. - * - * Hack by checking if the parent of the element is the same as the parent - * we search for children. It breaks depth >= 0, but as we don't use it for - * now it's OK. A little odd but it works. */ if (el->type & filter && - /*el->atts.entry.line >= parent->atts.entry.line &&*/ - /*scope_child_matches (fake_scope, el->atts.entry.scope, - geany_ft, depth) &&*/ ggd_tag_find_parent (tags, geany_ft, el) == parent) { children = g_list_insert_sorted_with_data (children, el, tag_cmp_by_line, GINT_TO_POINTER (GGD_SORT_ASC)); } } - /*g_free (fake_scope);*/
return children; } @@ -548,7 +467,6 @@ * @tags: Array of tags that contains @parent * @parent: Tag for which get children * @geany_ft: The Geany's file type identifier for which tags were generated - * @depth: Maximum depth for children to be found (< 0 means infinite) * * Finds children tags of a #TMTag. * <note><para>The returned list of children is sorted in the order they appears @@ -559,9 +477,7 @@ GList * ggd_tag_find_children (const GPtrArray *tags, const TMTag *parent, - filetype_id geany_ft, - gint depth) + filetype_id geany_ft) { - return ggd_tag_find_children_filtered (tags, parent, geany_ft, - depth, tm_tag_max_t); + return ggd_tag_find_children_filtered (tags, parent, geany_ft, tm_tag_max_t); }
Modified: geanygendoc/src/ggd-tag-utils.h 4 files changed, 1 insertions(+), 3 deletions(-) =================================================================== @@ -56,12 +56,10 @@ TMTag *ggd_tag_find_parent (const GPtrArray *tags, GList *ggd_tag_find_children_filtered (const GPtrArray *tags, const TMTag *parent, filetype_id geany_ft, - gint depth, TMTagType filter); GList *ggd_tag_find_children (const GPtrArray *tags, const TMTag *parent, - filetype_id geany_ft, - gint depth); + filetype_id geany_ft); gchar *ggd_tag_resolve_type_hierarchy (const GPtrArray *tags, filetype_id geany_ft, const TMTag *tag);
Modified: geanygendoc/src/ggd.c 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -179,7 +179,7 @@ ctpl_environ_push_int (env, "returns", returns); /* get direct children tags */ children = ggd_tag_find_children (tag_array, tag, - FILETYPE_ID (doc->file_type), 0); + FILETYPE_ID (doc->file_type)); if (setting->merge_children) { CtplValue *v;
@@ -546,7 +546,7 @@ if (setting && setting->autodoc_children) { tag_list = ggd_tag_find_children_filtered (tag_array, tag, FILETYPE_ID (doc->file_type), - 0, setting->matches); + setting->matches); } /* we assume that a parent always comes before any children, then simply add * it at the end */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org